Macaulay2 » Documentation
Packages » Graphs :: neighbors
next | previous | forward | backward | up | index | toc

neighbors -- returns the neighbors of a vertex in a graph



The neighbors of a vertex v are all the vertexSet of G adjacent to v. That is, if u is a neighbor to v, {v,u} is an edge of G.

i1 : G = graph({1,2,3,4},{{2,3},{3,4}});
i2 : neighbors(G,3)

o2 = set {2, 4}

o2 : Set

See also

Ways to use neighbors :

For the programmer

The object neighbors is a method function.