The neighborhood diversity of a finite nonempty simple graph is the number of equivalence classes
obtained by identifying twin vertices. Distinct
vertices
and
are in the same class exactly when
, where
denotes the open
graph neighborhood of
(Lampis 2012).
Each class induces a complete graph or an empty graph. Between two distinct classes either all possible edges are present or none are. Thus the graph can be reconstructed from a graph on the classes by replacing each class vertex with a clique or an independent set of the appropriate size. This substitution shows that the modular-width is at most the neighborhood diversity (Gajarský et al. 2013). A twin-free graph has neighborhood diversity equal to its number of vertices.
If a graph has a vertex cover of size , its neighborhood diversity is at most
. Vertices outside the cover form an independent
set and have at most
distinct neighborhoods in the cover. Lampis (2012) showed
that the twin partition can be computed in polynomial
time and used neighborhood diversity to obtain algorithms for deciding properties
expressed in monadic second-order logic with vertex-set quantification.