有graphviz- http://www.graphviz.org/。它使用“ DOT”语言绘制图形。您既可以自己生成DOT代码,也可以使用pydot-https://code.google.com/p/pydot/。您还可以使用networkx-http: //networkx.lanl.gov/tutorial/tutorial.html#drawing-graphs ,它可以很容易地绘制到graphviz或matplotlib。
networkx + matplotlib + graphviz为您提供最大的灵活性和功能,但是您需要安装很多东西。
安装Graphviz。
open('hello.dot','w').write("digraph G {Hello->World}")
import subprocess
subprocess.call(["path/to/dot.exe","-Tpng","hello.dot","-o","graph1.png"])
# I think this is right - try it form the command line to debug
然后安装pydot,因为pydot已经为您完成了这项工作。然后,您可以使用networkx来“驱动” pydot。