PyGraphviz
suggest changeGet PyGraphviz from the Python Package Index at http://pypi.python.org/pypi/pygraphviz
or install it with:
pip install pygraphviz
and an attempt will be made to find and install an appropriate version that matches your operating system and Python version.
You can install the development version (at github.com) with:
pip install git://github.com/pygraphviz/pygraphviz.git#egg=pygraphviz
Get PyGraphviz from the Python Package Index at http://pypi.python.org/pypi/pygraphviz
or install it with:
easy_install pygraphviz
and an attempt will be made to find and install an appropriate version that matches your operating system and Python version.
Load graph as defined by a DOT file
- The file is assumed to be in DOT format. It will be loaded, parsed, and an
AGraphwill be returned, representing the graph. For example, a simpledemo.dot:
digraph demo1{ a -> b -> c; c ->a; }
- Load it and draw it.
import pygraphviz as pgv
G = pgv.AGraph("demo.dot")
G.draw('test', format='svg', prog='dot')
You will get an SVG (Scalable Vector Graphics) like this. The path 'test' is the output filename; it does not add .svg by itself. demo.dot is not in this book. pygraphviz was not installed here, and these install commands were not run.