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,
periodic = FALSE,
circular = deprecated()
)
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.- periodic
Logical vector, Boolean vector, defines whether the generated lattice is periodic along each dimension. This parameter may also be scalar boolen value which will be extended to boolean vector with dimvector length.
- circular
Deprecated, use
periodic
instead.- ...
Passed to
make_lattice()
.
See also
Other deterministic constructors:
graph_from_atlas()
,
graph_from_edgelist()
,
graph_from_literal()
,
make_()
,
make_chordal_ring()
,
make_empty_graph()
,
make_full_citation_graph()
,
make_full_graph()
,
make_graph()
,
make_ring()
,
make_star()
,
make_tree()
Examples
make_lattice(c(5, 5, 5))
#> IGRAPH 7e40e4a U--- 125 300 -- Lattice graph
#> + attr: name (g/c), dimvector (g/n), nei (g/n), mutual (g/l), circular
#> | (g/l)
#> + edges from 7e40e4a:
#> [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 06795aa U--- 125 300 -- Lattice graph
#> + attr: name (g/c), dimvector (g/n), nei (g/n), mutual (g/l), circular
#> | (g/l)
#> + edges from 06795aa:
#> [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