A ring/cycle graph is a special case of a lattice graph with one dimension.
Usage
graph_square_lattice(
dim,
nei = 1L,
directed = FALSE,
mutual = FALSE,
circular = FALSE
)
graph_ring(n, directed = FALSE, mutual = FALSE, circular = TRUE)
# graph_lattice = graph_square_lattice
Arguments
- dim
An integer vector giving the sizes of the lattice in each of its dimensions.
- nei
An integer distance within which two vertices will be connected.
- directed
A logical value, whether to consider directed paths. Ignored for undirected graphs.
- mutual
A logical, whather to create mutual edges in directed graphs.
- circular
A logical, whether to create a closed ring/cycle or an open path.
- n
An integer value, the number of vertices.
Value
An igraph_ptr
object.
See also
Other deterministic generators:
graph_create()
,
graph_empty()
,
graph_famous()
,
graph_full()
,
graph_kary_tree()
,
graph_star()
Examples
graph_square_lattice(c(2L, 3L))
#> $V tibble [6 × 0] (S3: tbl_df/tbl/data.frame)
#> Named list()
#> # A tibble: 7 × 2
#> from to
#> <int> <int>
#> 1 2 1
#> 2 3 1
#> 3 4 2
#> 4 4 3
#> 5 5 3
#> 6 6 4
#> 7 6 5
graph_ring(4L)
#> $V tibble [4 × 0] (S3: tbl_df/tbl/data.frame)
#> Named list()
#> # A tibble: 4 × 2
#> from to
#> <int> <int>
#> 1 2 1
#> 2 3 2
#> 3 4 3
#> 4 4 1
graph_ring(4L, circular = FALSE)
#> $V tibble [4 × 0] (S3: tbl_df/tbl/data.frame)
#> Named list()
#> # A tibble: 3 × 2
#> from to
#> <int> <int>
#> 1 2 1
#> 2 3 2
#> 3 4 3