如果两个顶点与同一条边相连,则一个顶点是另一个顶点的邻居(换句话说,这两个顶点是邻接的)。
用法
neighbors(graph, v, mode = c("out", "in", "all", "total"))
参见
其他结构查询: [.igraph()
, [[.igraph()
, adjacent_vertices()
, are_adjacent()
, ends()
, get_edge_ids()
, gorder()
, gsize()
, head_of()
, incident()
, incident_edges()
, is_directed()
, tail_of()
示例
g <- make_graph("Zachary")
n1 <- neighbors(g, 1)
n34 <- neighbors(g, 34)
intersection(n1, n34)
#> + 4/34 vertices, from 47780a7:
#> [1] 9 14 20 32