Skip to contents

make_lattice() is a flexible function, it can create lattices of arbitrary dimensions, periodic or aperiodic ones. It has two forms. In the first form you only supply dimvector, but not length and dim. In the second form you omit dimvector and supply length and dim.

Usage

make_lattice(
  dimvector = NULL,
  length = NULL,
  dim = NULL,
  nei = 1,
  directed = FALSE,
  mutual = FALSE,
  circular = FALSE
)

lattice(...)

Arguments

dimvector

A vector giving the size of the lattice in each dimension.

length

Integer constant, for regular lattices, the size of the lattice in each dimension.

dim

Integer constant, the dimension of the lattice.

nei

The distance within which (inclusive) the neighbors on the lattice will be connected. This parameter is not used right now.

directed

Whether to create a directed lattice.

mutual

Logical, if TRUE directed lattices will be mutually connected.

circular

Logical, if TRUE the lattice or ring will be circular.

...

Passed to make_lattice().

Value

An igraph graph.

Examples

make_lattice(c(5, 5, 5))
#> IGRAPH 74b7b13 U--- 125 300 -- Lattice graph
#> + attr: name (g/c), dimvector (g/n), nei (g/n), mutual (g/l), circular
#> | (g/l)
#> + edges from 74b7b13:
#>  [1]  1-- 2  1-- 6  1--26  2-- 3  2-- 7  2--27  3-- 4  3-- 8  3--28  4-- 5
#> [11]  4-- 9  4--29  5--10  5--30  6-- 7  6--11  6--31  7-- 8  7--12  7--32
#> [21]  8-- 9  8--13  8--33  9--10  9--14  9--34 10--15 10--35 11--12 11--16
#> [31] 11--36 12--13 12--17 12--37 13--14 13--18 13--38 14--15 14--19 14--39
#> [41] 15--20 15--40 16--17 16--21 16--41 17--18 17--22 17--42 18--19 18--23
#> [51] 18--43 19--20 19--24 19--44 20--25 20--45 21--22 21--46 22--23 22--47
#> [61] 23--24 23--48 24--25 24--49 25--50 26--27 26--31 26--51 27--28 27--32
#> + ... omitted several edges
make_lattice(length = 5, dim = 3)
#> IGRAPH b2219df U--- 125 300 -- Lattice graph
#> + attr: name (g/c), dimvector (g/n), nei (g/n), mutual (g/l), circular
#> | (g/l)
#> + edges from b2219df:
#>  [1]  1-- 2  1-- 6  1--26  2-- 3  2-- 7  2--27  3-- 4  3-- 8  3--28  4-- 5
#> [11]  4-- 9  4--29  5--10  5--30  6-- 7  6--11  6--31  7-- 8  7--12  7--32
#> [21]  8-- 9  8--13  8--33  9--10  9--14  9--34 10--15 10--35 11--12 11--16
#> [31] 11--36 12--13 12--17 12--37 13--14 13--18 13--38 14--15 14--19 14--39
#> [41] 15--20 15--40 16--17 16--21 16--41 17--18 17--22 17--42 18--19 18--23
#> [51] 18--43 19--20 19--24 19--44 20--25 20--45 21--22 21--46 22--23 22--47
#> [61] 23--24 23--48 24--25 24--49 25--50 26--27 26--31 26--51 27--28 27--32
#> + ... omitted several edges