Neighboring (adjacent) vertices in a graphSource:
A vertex is a neighbor of another one (in other words, the two vertices are adjacent), if they are incident to the same edge.
neighbors(graph, v, mode = c("out", "in", "all", "total"))
The input graph.
The vertex of which the adjacent vertices are queried.
Whether to query outgoing (‘out’), incoming (‘in’) edges, or both types (‘all’). This is ignored for undirected graphs.