The twin-width of a finite nonempty simple graph measures how much disagreement is needed to reduce it to one vertex by merging pairs of vertices (Bonnet et al. 2022). Initially every graph edge is black. To merge two vertices, even if they are nonadjacent, replace them by one vertex. For every remaining vertex, the new pair is joined by a black edge if both old pairs were black edges, and by no edge if both old pairs were nonedges. It is joined by a red edge in every other case.
At each stage, the red degree of a vertex is the number of red edges incident to it. A -contraction sequence ends at a single
vertex and keeps every red degree at most
at every stage. The twin-width is the least
for which such a sequence exists. The graphs of twin-width
zero are precisely the cographs.
The twin classes defining neighborhood diversity can be merged without creating red edges. If there are classes, the first merge between classes leaves
vertices, each with red degree at most
.
Thus the twin-width is at most
. The two parameters
can differ arbitrarily, since cographs can have unbounded
neighborhood diversity (Gajarský
et al. 2013).
Given an -vertex
graph, a
-contraction
sequence, and a sentence
of first-order logic, Bonnet et al. (2022)
showed that whether the graph satisfies
can be decided in time
for a computable function
.
Deciding whether a graph has twin-width at most 4 is an NP-complete
problem (Bergé et al. 2022).
Bonnet and Chang (2026) showed that graphs of twin-width at most 2 have mim-width at most 8. Given a 2-contraction sequence, their algorithm constructs such a layout in polynomial time. This gives polynomial-time algorithms for graph coloring with any fixed number of colors, minimum dominating set, and minimum feedback vertex set when the sequence is given. With the number of colors supplied as part of the input, deciding colorability is NP-complete on the same class even with a supplied 2-contraction sequence.