1.7. igraph_lattice — Creates most kind of lattices.

int igraph_lattice(igraph_t *graph, const igraph_vector_t *dimvector, igraph_integer_t nei, 
		   igraph_bool_t directed, igraph_bool_t mutual, igraph_bool_t circular);

Arguments: 

graph:

An uninitialized graph object.

dimvector:

Vector giving the sizes of the lattice in each of its dimensions. Ie. the dimension of the lattice will be the same as the length of this vector.

nei:

Integer value giving the distance (number of steps) within which two vertices will be connected. Not implemented yet.

directed:

Boolean, whether to create a directed graph. The direction of the edges is determined by the generation algorithm and is unlikely to suit you, so this isn't a very useful option.

mutual:

Boolean, if the graph is directed this gives whether to create all connections as mutual.

circular:

Boolean, defines whether the generated lattice is periodic.

Returns: 

Error code: IGRAPH_EINVAL: invalid (negative) dimension vector.

Time complexity: if nei is less than two then it is O(|V|+|E|) (as far as i remember), |V| and |E| are the number of vertices and edges in the generated graph. Otherwise it is O(|V|*d^o+|E|), d is the average degree of the graph, o is the nei argument.