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

# closedNeighborhood -- Returns the closed neighborhood of a vertex of a graph

- Usage:
    `N = closedNeighborhood(G,v)`
- Inputs:
  - G, a graph,
  - v, a thing,
- Outputs:
  - N, a list, The closed neighborhood of vertex v in graph G

## Description

The closed neighborhood of a vertex v just the union of the open neighborhood (or neighbors) of v and the vertex v itself

    i1 : G = cycleGraph 4;

    i2 : closedNeighborhood(G,2)

    o2 = set {1, 2, 3}

    o2 : Set

## See also

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

## Ways to use closedNeighborhood:

- `closedNeighborhood(Graph,Thing)`

## For the programmer

The object closedNeighborhood is a method function.

The source of this document is in /build/macaulay2-88fgJW/macaulay2-1.25.11+ds/M2/Macaulay2/packages/Graphs.m2:3195:0.