NetworkX

Previous topic

networkx.grid_2d_graph

Next topic

networkx.hypercube_graph

networkx.grid_graph

grid_graph(dim, periodic=False, create_using=None)

Return the n-dimensional grid graph.

The dimension is the length of the list ‘dim’ and the size in each dimension is the value of the list element.

E.g. G=grid_graph(dim=[2,3]) produces a 2x3 grid graph.

If periodic=True then join grid edges with periodic boundary conditions.