GridGraph

GridGraph[{m,n}]

gives the grid graph with m×n vertices .

GridGraph[{n1,n2,,nk}]

gives the -dimensional grid graph with n1×n2××nk vertices .

Details and Options

  • GridGraph[{n1,n2,,nk}] gives a graph connected as a -dimensional grid with n1 vertices in dimension 1, n2 vertices in dimension 2, etc.
  • GridGraph[{n1,n2,,nk},DirectedEdges->True] gives a directed grid graph.
  • GridGraph takes the same options as Graph.

Examples

open allclose all

Basic Examples  (3)

The first few grid graphs:

In[1]:=
Click for copyable input
Out[1]=

Higher-dimensional grid graphs:

In[1]:=
Click for copyable input
Out[1]=

A directed grid graph:

In[1]:=
Click for copyable input
Out[1]=

Options  (80)

Applications  (7)

Properties & Relations  (7)

Neat Examples  (3)

See Also

Graph  GraphData  PathGraph  PlanarGraph  MeshRegion

Introduced in 2010
(8.0)