So I stumble upon a library called pydot. Which is a python wrapper for the Dot language of Graphviz. Both is open source.
An example i am trying now, after I install pydot
import pydot
graph = pydot.Dot(graph_type='graph',font='verdana')
graph.add_edge(pydot.Edge('John Doe','person',label='is a'))
graph.add_edge(pydot.Edge('John Doe','missing',label='status'))graph.write_png('test.png',prog='dot')
It is pretty good, as you can see in pydot.add_edge is to add edge, and you don't need to create a node, because, pydot edge is defined by pydot.Edge(src_node,dest_node)
pydot is included in ubuntu repository.
the project page is in:
http://dkbza.org/pydot.html
http://dkbza.org/pydot/pydot.html
No comments:
Post a Comment