Skip to content

Instantly share code, notes, and snippets.

@aeter
Created April 15, 2010 08:33
Show Gist options
  • Save aeter/366843 to your computer and use it in GitHub Desktop.
Save aeter/366843 to your computer and use it in GitHub Desktop.
#draw a graph:
import pygraphviz as pgv
def graph_as_png(graph=graph):
G = pgv.AGraph()
for nodes in graph:
G.add_node(nodes)
for nodes in graph:
for ch_nodes in graph[nodes]:
G.add_edge(nodes, ch_nodes)
G.layout(prog='dot')
G.draw('graph-pic.png')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment