as_adj_list: Adjacency lists

View source: R/conversion.R

as_adj_listR Documentation

Adjacency lists

Description

Create adjacency lists from a graph, either for adjacent edges or for neighboring vertices

Usage

as_adj_list(graph, mode = c("all", "out", "in", "total"))

as_adj_edge_list(graph, mode = c("all", "out", "in", "total"))

Arguments

graph

The input graph.

mode

Character scalar, it gives what kind of adjacent edges/vertices to include in the lists. ‘out’ is for outgoing edges/vertices, ‘in’ is for incoming edges/vertices, ‘all’ is for both. This argument is ignored for undirected graphs.

Details

as_adj_list returns a list of numeric vectors, which include the ids of neighbor vertices (according to the mode argument) of all vertices.

as_adj_edge_list returns a list of numeric vectors, which include the ids of adjacent edgs (according to the mode argument) of all vertices.

If igraph_opt("return.vs.es") is true (default), the numeric vectors of the adjacency lists are coerced to igraph.vs, this can be a very expensive operation on large graphs.

Value

A list of igraph.vs or a list of numeric vectors depending on the value of igraph_opt("return.vs.es"), see details for performance characteristics.

Author(s)

Gabor Csardi csardi.gabor@gmail.com

See Also

as_edgelist, as_adj

Examples


g <- make_ring(10)
as_adj_list(g)
as_adj_edge_list(g)


igraph documentation built on Sept. 22, 2022, 9:07 a.m.

Related to as_adj_list in igraph...