The modular decomposition of a graph recursively partitions its vertex
set using graph modules. A graph module is a
vertex set
such that every vertex outside
is adjacent either to every vertex of
or to no vertex of
. Equivalently, all vertices of
have the same neighbors outside
.
The strong modules, namely the modules that do not partially overlap any other module, form a rooted tree, called the modular decomposition tree (Habib and Paul 2010). Its internal nodes are classified as parallel when the graph on their child modules is an empty graph, series when it is a complete graph, and prime otherwise.
Modular decomposition can be computed in linear time and is used as a preprocessing step in many graph algorithms. A cograph is characterized by having a modular decomposition tree with no prime nodes. Classes of twin vertices are graph modules, although a module need not consist entirely of pairwise twins.