Simple generator of an n x 1 lattice where each vertex
is incident with each of its 2 neighbors (except possibly
for the vertices on the edge depending upon whether the lattice
is specified to be toroidal or not).
Simple generator of an n x n lattice where each vertex
is incident with each of its 4 neighbors (except possibly
for the vertices on the edge depending upon whether the lattice
is specified to be toroidal or not).