跳到内容

此函数类似于 neighbors(),但它一次查询多个顶点的相邻顶点。

用法

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

参数

graph

输入图。

v

要查询的顶点。

mode

是否查询出边(‘out’)、入边(‘in’)或两种类型的边(‘all’)。这对于无向图将被忽略。

顶点序列的列表。

参见

示例

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