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

## Synopsis

• Usage:
N = neighbors(G,v)
• Inputs:
• G, an instance of the type Graph,
• v, ,
• Outputs:
• N, a set, the neighbors of vertex v in graph G

## Description

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