# Neighbourhood (graph theory)

In graph theory, an adjacent vertex of a vertex v in a graph is a vertex that is connected to v by an edge. The neighbourhood of a vertex v in a graph G is the subgraph of G induced by all vertices adjacent to v, i.e., the graph composed of the vertices adjacent to v and all edges connecting vertices adjacent to v.
The neighbourhood is often denoted ⁠$N_{G}(v)$⁠ or (when the graph is unambiguous) ⁠$N(v)$⁠. The same neighbourhood notation may also be used to refer to sets of adjacent vertices rather than the corresponding induced subgraphs. The neighbourhood described above does not include v itself, and is more specifically the open neighbourhood of v; it is also possible to define a neighbourhood in which v itself is included, called the closed neighbourhood and denoted by ⁠$N_{G}[v]$⁠. When stated without any qualification, a neighbourhood is assumed to be open.
Neighbourhoods may be used to represent graphs in computer algorithms, via the adjacency list and adjacency matrix representations. Neighbourhoods are also used in the clustering coefficient of a graph, which is a measure of the average density of its neighbourhoods. In addition, many important classes of graphs may be defined by properties of their neighbourhoods, or by symmetries that relate neighbourhoods to each other.
An isolated vertex has no adjacent vertices. The degree of a vertex is equal to the number of adjacent vertices. A special case is a loop that connects a vertex to itself; if such an edge exists, the vertex belongs to its own neighbourhood.

## Local properties in graphs

If all vertices in G have neighbourhoods that are isomorphic to the same graph H, G is said to be locally H, and if all vertices in G have neighbourhoods that belong to some graph family F, G is said to be locally F. For instance, in the octahedron graph, shown in the figure, each vertex has a neighbourhood isomorphic to a cycle of four vertices, so the octahedron is locally C$_4$.
For example:
* Any complete graph K$_n$ is locally K$_{n-1}$. The only graphs that are locally complete are disjoint unions of complete graphs.
* A Turán graph T(rs,r) is locally T((r-1)s,r-1). More generally any Turán graph is locally Turán.
* Every planar graph is locally outerplanar. However, not every locally outerplanar graph is planar.
* A graph is triangle-free if and only if it is locally independent.
* Every k-chromatic graph is locally (k-1)-chromatic. Every locally k-chromatic graph has chromatic number $O({\sqrt {kn}})$.
* If a graph family F is closed under the operation of taking induced subgraphs, then every graph in F is also locally F. For instance, every chordal graph is locally chordal; every perfect graph is locally perfect; every comparability graph is locally comparable; every (k)-(ultra)-homogeneous graph is locally (k)-(ultra)-homogeneous.
* A graph is locally cyclic if every neighbourhood is a cycle. For instance, the octahedron is the unique connected locally C$_4$ graph, the icosahedron is the unique connected locally C$_5$ graph, and the Paley graph of order 13 is locally C$_6$. Locally cyclic graphs other than K$_4$ are exactly the underlying graphs of Whitney triangulations, embeddings of graphs on surfaces in such a way that the faces of the embedding are the cliques of the graph. Locally cyclic graphs can have as many as $n^{2-o(1)}$ edges.
* Claw-free graphs are the graphs that are locally co-triangle-free; that is, for all vertices, the complement graph of the neighbourhood of the vertex does not contain a triangle. A graph that is locally H is claw-free if and only if the independence number of H is at most two; for instance, the graph of the regular icosahedron is claw-free because it is locally C$_5$ and C$_5$ has independence number two.
* The locally linear graphs are the graphs in which every neighbourhood is an induced matching.
* The Johnson graphs are locally grid, meaning that each neighborhood is a rook's graph.

## Neighbourhood of a set

For a set A of vertices, the neighbourhood of A is the union of the neighbourhoods of the vertices, and so it is the set of all vertices adjacent to at least one member of A.
A set A of vertices in a graph is said to be a module if every vertex in A has the same set of neighbours outside of A. Any graph has a uniquely recursive decomposition into modules, its modular decomposition, which can be constructed from the graph in linear time; modular decomposition algorithms have applications in other graph algorithms including the recognition of comparability graphs.