This documents an unmaintained version of NetworkX. Please upgrade to a maintained version and see the current NetworkX documentation.
#!/usr/bin/env python """ An example showing how to use the interface to the pygraphviz AGraph class to draw a graph. Also see the pygraphviz documentation and examples at http://pygraphviz.github.io/ """ __author__ = """Aric Hagberg (email@example.com)""" # Copyright (C) 2006 by # Aric Hagberg <firstname.lastname@example.org> # Dan Schult <email@example.com> # Pieter Swart <firstname.lastname@example.org> # All rights reserved. # BSD license. from networkx import * # plain graph G=complete_graph(5) # start with K5 in networkx A=to_agraph(G) # convert to a graphviz graph A.layout() # neato layout A.draw("k5.ps") # write postscript in k5.ps with neato layout