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

Synopsis

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

Description

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

 i1 : G = graph({1,2,3,4},{{2,3},{3,4}}); i2 : nonneighbors(G,2) o2 = set {1, 4} o2 : Set

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

Ways to use nonneighbors :

• "nonneighbors(Graph,Thing)"

For the programmer

The object nonneighbors is .