Skip to content

Instantly share code, notes, and snippets.

@danaoira
Created March 1, 2016 04:18
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save danaoira/72d368cd271af821817e to your computer and use it in GitHub Desktop.
Save danaoira/72d368cd271af821817e to your computer and use it in GitHub Desktop.
Simple Graphviz Example
>>> from graphviz import Digraph
>>> cgv = Digraph(comment='CGV')
>>> cgv.note('A')
Traceback (most recent call last):
File "<pyshell#21>", line 1, in <module>
cgv.note('A')
AttributeError: 'Digraph' object has no attribute 'note'
>>> cgv.node('A')
>>> cgv.node('B')
>>> cgv.edge('A', 'B')
>>> cgv.format = 'dot'
>>> cgv.render()
'Digraph.gv.dot'
>>> cgv.render('digraph.gv.dot', view=True)
'digraph.gv.dot.dot'
digraph {
graph [bb="0,0,54,108"];
node [label="\N"];
A [height=0.5,
pos="27,90",
width=0.75];
B [height=0.5,
pos="27,18",
width=0.75];
A -> B [pos="e,27,36.104 27,71.697 27,63.983 27,54.712 27,46.112"];
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment