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.

...

These dots are for future extensions and must be empty.

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.

vcount()

Examples

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