A vertex is a neighbor of another one (in other words, the two vertices are adjacent), if they are incident to the same edge.
Usage
neighbors(graph, v, mode = c("out", "in", "all", "total"))
See also
Other structural queries:
[.igraph()
,
[[.igraph()
,
adjacent_vertices()
,
are_adjacent()
,
ends()
,
get_edge_ids()
,
gorder()
,
gsize()
,
head_of()
,
incident()
,
incident_edges()
,
is_directed()
,
tail_of()
Examples
g <- make_graph("Zachary")
n1 <- neighbors(g, 1)
n34 <- neighbors(g, 34)
intersection(n1, n34)
#> + 4/34 vertices, from 8724529:
#> [1] 9 14 20 32