Skip to content

Instantly share code, notes, and snippets.

@alan-mushi
Created December 26, 2015 12:23
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 alan-mushi/845478267583b060f172 to your computer and use it in GitHub Desktop.
Save alan-mushi/845478267583b060f172 to your computer and use it in GitHub Desktop.
Easy graphviz for a simple graph in Python 3
# Install graphviz using pip3 (on archlinux):
# $ sudo pip3 install graphviz
import graphviz as gv
g1 = gv.Graph(format="svg") # "svg" or "dot"
g1.node('A')
g1.node('B')
g1.node('C')
g1.edge('A', 'C')
g1.edge('B', 'C')
g1.view()
g1.render('/tmp/g1')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment