#!/usr/bin/env python """ Draw a graph with matplotlib. You must have matplotlib for this to work. """ __author__ = """Aric Hagberg (hagberg@lanl.gov)""" __date__ = "$Date: 2005-03-22 13:57:46 -0700 (Tue, 22 Mar 2005) $" __credits__ = """""" __revision__ = "$Revision: 831 $" # Copyright (C) 2004 by # Aric Hagberg # Dan Schult # Pieter Swart # Distributed under the terms of the GNU Lesser General Public License # http://www.gnu.org/copyleft/lesser.html try: from pylab import * except: print "pylab not found: see https://networkx.lanl.gov/Drawing.html for info" raise from networkx import * # import networkx after pylab G=grid_2d_graph(4,4) #4x4 grid draw(G) savefig("grid.png") # save as png show() # display