Skip to contents

Create an undirected graph from an adjacency list

Usage

nug_from_adj_list(adj_list, ...)

Arguments

adj_list

A list of integer vectors. The i-th element contains the 1-indexed neighbors of vertex i.

...

Additional arguments: seed (integer) for reproducible RNG.

Value

A NaturalUndirectedGraph object.

See also

Examples

# Path graph: 1 -- 2 -- 3
adj <- list(c(2L), c(1L, 3L), c(2L))
g <- nug_from_adj_list(adj)
g$nvertices()
#> [1] 3