Skip to contents

This function is similar to neighbors(), but it queries the adjacent vertices for multiple vertices at once.

Usage

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

Arguments

graph

Input graph.

v

The vertices to query.

mode

Whether to query outgoing (‘out’), incoming (‘in’) edges, or both types (‘all’). This is ignored for undirected graphs.

Value

A list of vertex sequences.

See also

Other structural queries: [.igraph(), [[.igraph(), are_adjacent(), ends(), get_edge_ids(), gorder(), gsize(), head_of(), incident(), incident_edges(), is_directed(), neighbors(), tail_of()

Examples

g <- make_graph("Zachary")
adjacent_vertices(g, c(1, 34))
#> [[1]]
#> + 16/34 vertices, from 6423b0c:
#>  [1]  2  3  4  5  6  7  8  9 11 12 13 14 18 20 22 32
#> 
#> [[2]]
#> + 17/34 vertices, from 6423b0c:
#>  [1]  9 10 14 15 16 19 20 21 23 24 27 28 29 30 31 32 33
#>