How can python write a dot file for GraphViz asking for some edges to be colored red?
问题 I am using python code (with python nested dicts) to write out a DOT file for GraphViz to draw my directed edge-weighted graph, thanks to DAWG's suggestions... nestedg={1: {2: 3, 3: 8, 5: -4}, 2: {4: 1, 5: 7}, 3: {2: 0.09}, 4: {1: 2, 3: -5}, 5: {4: 6}} with open('/tmp/graph.dot','w') as out: for line in ('digraph G {','size="16,16";','splines=true;'): out.write('{}\n'.format(line)) for start,d in nestedg.items(): for end,weight in d.items(): out.write('{} -> {} [ label="{}" ];\n'.format(start