Grid graph (source code)

= Grid graph
{wiki}

The grid graph $[k]^d$ has vertices in the Cartesian power $\{1,\ldots,k\}^d$ and joins two vertices when they differ by one in exactly one coordinate.