pydot + graphviz

Install pydot
Install graphviz

$ python
Python 2.5.1 (r251:54863, Feb  9 2009, 18:49:36) 
[GCC 4.0.1 (Apple Inc. build 5465)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import pydot
>>> edges=[('1','2'), ('1','3'), ('1','4'), ('3','4')]
>>> g=pydot.graph_from_edges(edges)
>>> g.write_jpeg('graph_from_edges_dot.jpg', prog='dot')
True
>>>

result:
example

Leave a Reply