Twin-Width One
Abstract
We investigate the structure of graphs of twin-width at most , and obtain the following results:
-
Graphs of twin-width at most are permutation graphs. In particular they have an intersection model and a linear structure.
-
There is always a -contraction sequence closely following a given permutation diagram.
-
Based on a recursive decomposition theorem, we obtain a simple algorithm running in linear time that produces a -contraction sequence of a graph, or guarantees that it has twin-width more than .
-
We characterise distance-hereditary graphs based on their twin-width and deduce a linear time algorithm to compute optimal sequences on this class of graphs.
Keywords and phrases:
Twin-width, Hereditary graph classes, Intersection modelFunding:
Jungho Ahn: Supported by the KIAS Individual Grant (CG095301) at Korea Institute for Advanced Study.Copyright and License:
![[Uncaptioned image]](x1.png)
Sebastian Wiederrecht; licensed under Creative Commons License CC-BY 4.0
2012 ACM Subject Classification:
Mathematics of computing Combinatorial algorithms ; Mathematics of computing Graph algorithmsAcknowledgements:
The authors wish to thank the organisers of the 1st Workshop on Twin-width, which was partially financed by the grant ANR ESIGMA (ANR-17-CE23-0010) of the French National Research Agency. The second author wishes to thank Paul Bastide and Carla Groenland for interesting initial discussions on the topic of this paper.Editors:
Olaf Beyersdorff, Michał Pilipczuk, Elaine Pimentel, and Nguyễn Kim ThắngSeries and Publisher:

1 Introduction
Twin-width is a graph invariant introduced by Bonnet, Kim, Thomassé, and Watrigant [11] as a generalisation of a parameter on permutations introduced by Guillemot and Marx [21]. The main result of the seminal paper [11] is an FPT algorithm for FO model-checking on graphs of bounded twin-width, when given a contraction sequence certifying their width. Graphs of bounded twin-width capture a wide variety of classes such as bounded rank-width and proper minor-closed classes, unifying many results on tractable FO model-checking. Furthermore, it gives an exact dichotomy between tractability and intractability of FO model-checking for hereditary classes of ordered structures [8] and of tournaments [19].
While these results are sufficient to consider twin-width an important graph parameter, we are still lacking an FPT algorithm for computing “good” contraction sequences, i.e. contraction sequences of width bounded by a function of the twin-width. Such an algorithm is required for FO model-checking to be FPT on bounded twin-width classes. Regarding exact algorithms for twin-width, it is known that computing twin-width is hard even for constant values: distinguishing graphs of twin-width from graphs of twin-width is NP-hard [5]. Still, a polynomial-time algorithm for recognizing graphs of twin-width was given in [10], where the worst-case time complexity is not explicitly given but corresponds to a polynomial of degree or depending on implementation. Meanwhile, the hardness of recognizing twin-width and graphs remains open. Nevertheless, it is known that sparse graphs of twin-width have bounded treewidth [7]. As for approximation, there is an algorithm to compute contraction sequences of approximate width for ordered structures [8]. It is still wide open whether there is an XP, let alone FPT, approximation algorithm in the general case. Regarding parameterized algorithms, some results are known with parameters that are still quite far from twin-width [3, 4]. Interestingly, the more general parameter flip-width introduced by Torunczyk [25] has an XP approximation algorithm but the status of FO model-checking for this parameter is unknown.
In this paper, we are interested in the structure of graphs of twin-width , and in the complexity of their recognition. Let us briefly recall the definition of -contraction sequences, which are witnesses for twin-width at most . Given a graph , a contraction sequence of starts with , and consists in a sequence of identifications of pairs of vertices (contractions) recording “neighbourhood errors” as red edges, ending with a graph on a single vertex. Specifically, at each step, we create red edges from the contracted vertex to vertices that were not homogeneous to the pair. That is, vertices which were not both adjacent or non-adjacent to the pair. In particular, red edges remain red. Then, a -contraction sequence is one where at each step the vertices have most incident red edges.
Towards understanding graphs of twin-width one, it will be useful to look at the structure and behaviour of classes of graphs which are related. There is a rich literature on hereditary classes of graphs related to perfect graphs. It follows from the following observation and the strong perfect graph theorem [13] that twin-width graphs are perfect graphs. It is then natural to wonder how they compare to other subclasses of perfect graphs.
Observation 1 (See [1, Lemma 2.3]).
Every cycle of length at least has twin-width . This also implies that complements of cycles of length at least have twin-width .
A natural way of understanding classes of twin-width at most is to interpret them as a generalization of cographs. Indeed, cographs are exactly the graphs which admit a sequence of twin identifications ending in a single vertex, that is, graphs of twin-width . Then, graphs of twin-width correspond to relaxing the twin condition to allow for at most “twin errors”.
We now compare twin-width graphs with other generalisations of cographs. Cographs are the graphs of clique-width at most . In this direction, cographs are generalised by the class of distance-hereditary graphs which are themselves closely related to graphs of clique-width at most [14]. Distance-hereditary (DH) graphs are not closed by complementation, and have a tree-like structure. They also have a characterisation by a sequential elimination of twins and pendant vertices. Cographs are permutation graphs, which is exactly the complementation-closed class of graphs whose edges can be transitively oriented [17]. Permutation graphs are asteroidal triple-free (AT-free), as such, they are dominated by a path [15]. A caterpillar is an AT-free tree , the following result suggests a relation between AT-free graphs and twin-width .
Lemma 2 (Ahn, Hendrey, Kim, and Oum [2, Lemma 6.6]).
For a tree , if and only if is a caterpillar.
Cographs, distance-hereditary graphs, and permutation graphs can all be recognised in linear time. It is only natural to expect that the closely related class of twin-width graphs can also be recognised efficiently.
Previous results on graphs of twin-width at most
The recognition algorithm for twin-width one given in [10] makes use of the relation between modules and twin-width, by observing that the twin-width of a graph can be determined by considering independently the subgraphs induced by modules (see Lemma 5). It is straightforward to deduce that the twin-width of a graph is the maximal twin-width over all prime nodes of its modular decomposition (defined in Section 2). Since this decomposition may be computed in linear time [24], one then only needs to recognise prime graphs of twin-width one. In their paper [10], the recognition is done by branching on valid sequences that have at most one red edge at any intermediate step of the sequence, after the observation that such sequences always exist. Furthermore, when the trigraph has a red edge, the only possible contractions in such a sequence involve at least one vertex of the red edge. Essentially, the complexity of their algorithm stems from the need to branch over all possible first contractions, to greedily simulate a contraction sequence for each possible first contraction, and the lack of an efficient way to detect eventual twins to be contracted at each step. In particular, a more explicit understanding of the structure of graphs of twin-width at most seems to be required to avoid the enumeration of all pairs of possible first contractions.
Our results
We investigate the structure of graphs of twin-width at most , and uncover that it defines a relatively well-behaved hereditary class of graphs, which fits surprisingly well in the landscape of classical hereditary classes. Graphs of twin-width at most were already known to have some form of linear structure, due to a bound on their linear rankwidth if they are prime (see Lemma 7 and [9]). We show that they are in fact contained in the class of permutation graphs, thus they admit an intersection model called “permutation diagram”, making it easier to reason on their structure. Furthermore, we show that there is a close relationship between permutation diagrams and -contraction sequences. We use these structural results to obtain a recursive decomposition theorem for prime graphs of twin-width at most . We then use it to devise a simple linear time algorithm to compute a -contraction sequence, or conclude that the graph has twin-width more than . The algorithm starts by computing a permutation diagram and a modular decomposition which can be done in time , where is the number of vertices and is the number of edges, and then it checks that the diagram respects the decomposition theorem in time .
Regarding the challenge of avoiding the enumeration of possible first contractions, we can significantly reduce the number of candidates by using the permutation diagram and related properties of contraction sequences. We consider a slightly different scheme to avoid this challenge. Instead of guessing the first contraction, we guess the vertex that will be contracted last. It turns out that, in well-behaved contraction sequences, such a vertex holds a special position in permutation diagrams, reducing the number of candidates to . However, we do not exclude the possibility that the scheme of the previous algorithm can be implemented in linear time with some further arguments.
Interestingly, our structural analysis via the permutation diagrams allows us to avoid a characterisation by forbidden induced subgraphs. Moreover, we prove most structural tools inductively and in a unified way instead of proving the observations required for our algorithm separately.
In the full version, we also present some intermediate results on distance-hereditary graphs and split decompositions that turned out to be unnecessary for the recognition algorithm thanks to the use of permutation diagrams. We show that twin-width trigraphs with a pendant red edge are distance-hereditary. We also show that distance-hereditary graphs have twin-width at most . Combining these results, we can compute an optimal contraction sequence for distance-hereditary graphs in linear time. We also obtain a simple inductive proof that all distance-hereditary AT-free graphs are permutation graphs, and a characterisation of the twin-width of a distance-hereditary graph by the structure of its split decomposition. This is a generalisation of the characterisation of twin-width trees [2] mentioned above.
Distance-hereditary graphs are also related to the following infinite family of permutation graphs of twin-width : linking two obstructions to distance-hereditary graphs (domino, house, or gem) by a path of arbitrary length. In particular, this class of examples shows that a linear time algorithm for the recognition of twin-width graphs cannot be deduced from the linear algorithm to find patterns in a permutation of Guillemot and Marx [21].
We also observe that bipartite graphs of twin-width constitute a well-behaved subclass. Indeed, in their -contraction sequences, all trigraphs are bipartite. This is because there are no induced odd cycles of length more than , and triangles have at most one red edge from which we can deduce an original edge and complete it in a triangle of the starting graph (this is a particular case of 14).
Perspectives
One may hope that understanding the structure of graphs of twin-width well enough can guide a subsequent study of graphs of twin-width . We expect that this hereditary class can be characterised by a tree-like decomposition with a very constrained local structure. Our results also point toward the fact that split decompositions could be a convenient tool for the analysis of the structure of twin-width graphs.
In another direction, one may wonder if it is possible to compute other values of the twin-width efficiently for permutation graphs. An FPT approximation algorithm is already known in this setting [11], although one may try to find tighter approximation bounds.
Organisation
We organise this paper as follows. In Section 2, we present some terminology and useful known results on twin-width, and on permutation graphs. In Section 3, we show that every graph of twin-width at most is a permutation graph. In Section 4, we present a linear-time algorithm that recognises graphs of twin-width at most .
2 Preliminaries
In this paper, all graphs are finite and simple. For an integer , we denote by the set of positive integers at most . Note that if , then is an empty set. A subset is an interval of if there are integers such that .
Let be a graph. We denote the complement graph by . For a vertex of , we denote by the set of neighbours of , and let . Then, . For a set , let and let . Distinct vertices and of are twins in if . For a set , we denote by the subgraph of induced by . A dominating set of is a set such that . A dominating path of is a path whose vertex set is a dominating set of . Three vertices form an asteroidal triple if each pair of vertices is connected by a path that does not dominate the third vertex. A graph is asteroidal triple-free (AT-free) if it contains no asteroidal triple. An independent set of a graph is a set such that has no edge between two vertices in .
A module of a graph is a set such that for every vertex , is either adjacent to every vertex in , or nonadjacent to every vertex in . If is not a module, we call splitter of a vertex , that has both a neighbour and a non-neighbour in . Note that is a module exactly if it has no splitter. A module is trivial if it either has size at most , or is equal to . A graph is prime with respect to modules, or simply prime, if all of its modules are trivial. A modular partition of a graph is a partition of where each part is a module of . For a modular partition of a graph , we denote by , the subgraph of induced by a set containing exactly one vertex from each . A module is strong if it does not overlap with any other module, i.e. for every module , we have , or , or .
The modular decomposition of a graph is a tree corresponding to the recursive modular partition by the maximal strong modules. The leaves of the tree are vertices of , and each internal node has an associated quotient graph which encodes the adjacency relation between vertices of introduced in subtrees below . In particular, quotient graphs are induced subgraphs of , and the modular decomposition of an induced subgraph of can easily be deduced from the modular decomposition of . There are three types of internal nodes: series, parallel, and prime, corresponding to cliques, independent sets and prime graphs (with respect to modules). Prime graphs are graphs whose modules are all trivial i.e. singletons and the complete vertex set. Series and parallel nodes are called degenerate, and two degenerate nodes of the same type may not be adjacent in . The reason they are called degenerate is because any subset of vertices of a clique or an independent set is a module. Cographs are exactly the graphs whose modular decompositions have no prime nodes, their modular decomposition is usually called a cotree.
2.1 Permutation graphs
A graph on vertices is a permutation graph if there are two linear orderings and such that two vertices and are adjacent in if and only if is an inversion of . We remark that and its inverse permutation have the same set of inversions. A permutation diagram of with respect to and is a drawing of line segments between two parallel lines and such that each of and has distinct points, and for each , there is a line segment between -th point of and -th point of . Note that two vertices are adjacent in if and only if their corresponding line segments intersect each other in the permutation diagram.
We denote by the graph on where is an edge if and only if is an inversion of . As pointed earlier, we have . If , we call a realiser of (as a permutation graph).
For an ordering of , we define intervals of as follows: for an interval of , we have an interval of for that we denote by . We extend the notation to open intervals similarly.
We say that is an interval of realiser if it is an interval for or for . We also say that are consecutive for if is an interval of . Similarly, two intervals are consecutive if their union is an interval. We say that is a common interval of realiser if it is an interval for and for . A vertex of is extremal for realiser (or equivalently the corresponding permutation diagram) if it is the first or last vertex of or .
It is known that for a prime permutation graph, its permutation diagram (or equivalently its realiser) is unique up to symmetry [18, 20]. More generally, the modular decomposition encodes all possible realisers. Furthermore, we have the following known observation which will be very convenient for our analysis.
Observation 3.
If is a common interval of a realiser of , then is a module of . Conversely, if is a strong module of , then it is a common interval of all realisers.
It will also be useful to note that extremal vertices of a prime permutation graph do not depend on the realiser. See [22, 16, 6, 12] for further details on this.
Moreover, for a permutation diagram of with respect to linear orderings and of , if we reverse one of and , then we obtain a permutation diagram of . In other words, has a permutation diagram with respect to and , or to and .
Thus, a graph is a permutation graph if and only if is a permutation graph.
2.2 Trigraphs and twin-width
A trigraph is a triple where and are disjoint sets of unordered pairs of . We denote by the union of and . The edges of are the elements in . The black edges of are the elements of , and the red edges of are the elements of . We identify a graph with a trigraph .
The underlying graph of a trigraph is the graph . We identify with its underlying graph when we use standard graph-theoretic terms and notations. A black neighbour of is a vertex with and a red neighbour of is a vertex with . The red degree of is the number of red neighbours of . For an integer , a -trigraph is a trigraph with maximum red degree at most . For a set , we denote by the trigraph obtained from by removing all vertices in . If , then we write for .
For a trigraph and distinct vertices and of , we denote by the trigraph obtained from by adding a new vertex such that for every vertex , the following hold:
-
if is a common black neighbour of and , then ,
-
if is adjacent to none of and , then , and
-
otherwise, .
We say that is obtained by contracting and .
A contraction sequence of is a sequence of trigraphs where , as a single vertex, and is obtained from by contracting a pair of vertices. For an integer , a contraction sequence is a -sequence if for every , the maximum red-degree of is at most . The twin-width of , denoted by , is the minimum integer such that there is a -sequence of .
The vertices of the trigraphs in the contraction sequence can be interpreted as a partition of , this leads to a very natural characterisation of red edges in a trigraph as pairs of part such that the relation between vertices in the two parts is not homogeneous (i.e. there is an edge and a non-edge).
We have the following observations from [11].
Observation 4 (Bonnet, Kim, Thomassé, and Watrigant [11]).
For a graph , the twin-width of is equal to that of , and every induced subgraph of has twin-width at most .
Lemma 5 (Bonnet, Kim, Reinald, Thomassé, and Watrigant [10, Lemma 9]).
Let be a graph and let be a modular partition. Then
We sketch the proof as this will be of importance throughout the paper.
Proof.
A contraction in a module does not create red edges incident to . Therefore, we can always first contract the induced subgraphs in any order, and then contract once all subgraphs have been contracted to single vertices.
Corollary 6.
The twin-width of a graph is equal to the maximum twin-width of the quotient graphs of nodes of its modular decomposition.
Proof.
We may always contract leaf nodes of the modular decomposition via their optimal contraction sequence until the whole graph is reduced to a single vertex. This corresponds exactly to a recursive application of the above lemma with maximal strong modules.
The above statements show that computing the twin-width of a graph reduces to the case of a prime graph. Thus, throughout this paper, we focus on prime graphs of twin-width at most . The following lemma on the structure of twin-width graphs will be useful.
Lemma 7 (Bonnet, Kim, Reinald, Thomassé, and Watrigant [10, Lemma 31]).
Let be a prime graph of twin-width and let be a -sequence of . Then for every , the trigraph has exactly one red edge.
3 Permutation diagrams
In this section, we show that every graph of twin-width at most is a permutation graph.
Theorem 8.
Every graph of twin-width at most is a permutation graph.
It would be sufficient to prove that graphs of twin-width at most 1 are comparability graphs. Indeed, since twin-width is stable by complementation, this implies that graphs of twin-width at most 1 are also co-comparability graphs. We could then conclude because permutation graphs are exactly the graphs that are both comparability and co-comparability graphs [17]. To do this, one could make use of the following characterisation of comparability graphs via forbidden induced subgraphs given by Gallai [18] (see also [23]).
Theorem 9.
We instead present a constructive proof because it gives combinatorial insights on the relationship between contraction sequences and permutation diagrams that will be useful to find an efficient recognition algorithm. The trick is to decompose the graph by considering the contraction sequence backwards and to realise that vertices that are contracted together at some point in the contraction sequence should be consecutive or almost consecutive in a realiser.
The following recursive decomposition of twin-width 1 graphs is meant as a simple introduction to the technique. This decomposition will later be strengthened in Lemma 11 and Corollary 15. We abusively extend the terminology of universal vertex and isolated vertex to modules such that replacing by a single vertex makes it universal or isolated.
Lemma 10.
The class of graphs of twin-width at most 1 satisfies the following recursive characterisation:
Proof.
Consider a graph such that there exists a module such that and . If is universal or isolated, is a module of and, by Lemma 5, is also a graph of . If admits a partial -contraction sequence ending with edge , then is also a partial -contraction sequence of , and can be extended to be -contraction sequence of . Indeed, no red edge incident to appears when applying to since pairs of contracted vertices are always either in or , we can then apply the -contraction sequence of , and finally contract arbitrarily the resulting 3-vertex trigraph.
Conversely, consider a graph of . It admits a -contraction sequence with a -vertex trigraph . has at most one red edge (pick arbitrarily in if there is no red edge). We consider . The set of vertices of that were contracted to form is a module since there are no incident red edges in . and since they are induced subgraphs of . Let and be the sets of vertices that were contracted to form and , respectively. Since has no red neighbour, it must be that or , similarly, or . We conclude that is universal, isolated or admits a contraction sequence ending with the edge .
Given a permutation graph and , we denote by and the restrictions of and (re-numbered by ). They form a realiser of as a permutation graph. We also use the notation to denote the concatenation of two orderings on disjoint domains (all elements of are before elements of , relative orders in and are preserved).
The following lemma implies Theorem 8.
Lemma 11.
Let be a graph of twin-width at most , and be a fixed -contraction sequence of .
Then is a permutation graph admitting a realiser satisfying the following.
-
For every , is an interval of .
-
For every , if , then is an interval on one of the orderings , and both and are intervals on the other ordering.
Proof.
We proceed by induction on the number of vertices of the graph by leveraging the recursive characterization given in Lemma 10.
The statement is trivial for graphs on at most vertices. We now consider a graph on more than vertices and its contraction sequence . Let be the set of vertices of that were contracted into a vertex of not incident to a red edge in , is a module of . Restricting the sequence to and , respectively, yields a -contraction sequence for each of them. By induction hypothesis applied with these sequences, we obtain realisers and of and , respectively. The following cases are illustrated in Figure 1. If is universal (resp. isolated), (resp. ) is a realiser of . Otherwise, the contraction sequence is such that . In particular, we know from the induction hypothesis that and are intervals of either or , as they correspond to the sets of vertices contracted into the last two vertices on the sequence. Without loss of generality, we assume they are intervals of . We can now produce the realiser . In all cases, the realiser satisfies the desired properties: it suffices to observe that by construction we do not contract vertices from with vertices from until the last two contractions, so we must check only the last two contractions which are on trigraphs of order at most hence the properties are satisfied.
We now move on to show related properties that will be useful in further understanding permutation diagrams and their relation to contraction sequences.
In the particular case of a prime graph, we deduce the following two corollaries of Lemma 11.
Corollary 12.
In a prime graph of twin-width , the first contraction must involve two vertices that are consecutive for one ordering, and with exactly one vertex between them for the other ordering.
Proof.
In , let be the vertices incident to the red edge (there is a red edge because the graph is prime, see Lemma 7) with resulting of the contraction of vertices and of . is an interval for one ordering of the realiser. must be a splitter of because it is incident to the red edge, this implies that is between and in the ordering .
Unfortunately, there can be linearly many such pairs. On the other hand, there are only extremal vertices in a prime permutation graph. Hence, the following corollary is useful for obtaining a linear time recognition algorithm.
Corollary 13.
In a prime graph of twin-width , for any -contraction sequence, the last vertex to become incident to the red edge is an extremal vertex of the realiser.
Proof.
Due to the graph being prime, the last vertex of to become incident to the red edge is also a vertex of and is adjacent to exactly one other vertex of . The other two vertices of are connected because prime graphs are connected, hence is isomorphic to whose vertices are all extremal. In particular, the last vertex incident to the red edge is extremal.
Observation 14.
If are the trigraphs of a 1-contraction sequence of , their underlying graphs form a chain for the induced subgraph relation, i.e. is an induced subgraph of for .
Proof.
We describe how to construct the induced subgraph of by picking a representative in for each vertex in .
Consider a vertex of , either it has only black incident edges and we may pick any vertex of that was contracted into , or it has exactly one incident red edge , in which case we can pick the endpoints of some edge of that is between the vertices contracted into and the vertices contracted into .
This construction picks only one vertex of per vertex of because the red degree is at most one meaning we do not pick more than once.
This property only holds for -contraction sequences (e.g. contracting non-adjacent vertices of a matching creates a path on vertices which is not an induced subgraph). It allows to view the contraction sequence as a sequence of vertex deletions. In particular, underlying graphs of the trigraphs of a -contraction sequence are also permutation graphs and one of their permutation diagrams is the induced permutation diagram obtained by seeing as an induced subgraph of . Observe that this diagram preserves the relative order of vertices that are not deleted. This will be important for our inductive reasoning since we can keep the same diagram while decomposing the graph. We denote by the ordering induced by seen as an induced subgraph of .
Corollary 15.
Let be a graph and a -contraction sequence of . The realiser constructed from using Lemma 11 has the property that, for every , the vertices being contracted from to are consecutive for , and endpoints of red edges are consecutive for .
Conversely, for any realiser , there exists a -contraction sequence such that for every the contracted vertices of are consecutive in and for any , and are consecutive in .
Proof.
Suppose we contract into vertex . Let be the set of vertices of contracted into , and those contracted into . By Lemma 11, , and are all intervals of . Since , we may assume without loss of generality they are all intervals of . Hence, and are consecutive for . Similarly, the set of vertices of contracted into a fixed red edge is an interval of . Since the sets of vertices of incident to the red edge are also intervals, this means the endpoints of the red edge in are consecutive.
Now, consider any realiser for graph , and let us show the second part of the lemma by induction on the modular decomposition of . The result holds trivially for leaves of the decomposition. Let us then consider an internal node of the decomposition of and consider the subgraphs of induced by the children of . Now, since each is a strong module of , they each form a common interval of by Observation 3. They also have twin-width , so our induction hypothesis along with Lemma 5 yields that we can contract each child fully by respecting the consecutivity properties on , and thus on . Then, if is a degenerate node, we can always find a pair of consecutive twins and contract them. Otherwise, is prime, and as such it admits a unique realiser (up to symmetry), which is given by Lemma 11, for which the contraction sequence satisfies the desired properties by the first part of the lemma.
4 Linear-time recognition algorithm
A realiser , if it exists, can be found in linear time [24]. From the Corollaries 6, 12 and 15, we deduce that the algorithm of [10] can be implemented in time . Indeed, for every prime node of the modular decomposition, it suffices to compute and for its quotient graph. At this point, we have restricted the set of possible first contractions to the set all pairs of consecutive vertices, and we may then simulate contraction sequences efficiently using the fact that new vertices to be contracted can be found in constant time, since they are consecutive. In order to obtain a linear time algorithm, we will instead guess the end of the sequence, and try to extend the sequence from its end, see Figure 2.
Lemma 16.
Let be a prime permutation graph of twin-width 1, which admits a -contraction sequence where an extremal vertex is last to become incident to a red edge. Let also and .
Then, there is a module of for some that has a unique splitter , such that admits a -contraction sequence where is the last vertex to be incident to the red edge, where:
-
(i)
either is a pair of consecutive twins in and there are no prime nodes in the modular decompositions of and ,
-
(ii)
or corresponds to the subtree rooted at a prime node in the modular decomposition, and is the unique prime node in the modular decompositions of and .
Moreover, let there is an ordering such that for all , forms an interval of and two intervals of for a realiser where is the linear ordering for which is extremal.
Proof.
Let be a realiser of and be an extremal vertex for which is the last vertex incident to the red edge in some -contraction sequence of . Such a vertex exists due to Corollary 13. Let and and observe that since is prime, and are not empty. As is extremal for , adjacent to and non-adjacent to , and must be disjoint intervals of .
Claim 17.
In any contraction sequence as considered, we only contract pairs of vertices of or pairs of vertices of until we reach the -vertex trigraph.
Proof.
Due to the assumption on being the last vertex incident to a red edge, we cannot contract a vertex of with a vertex of , unless and both have been contracted to a single vertex, because they are split by .
Claim 18.
For any non-trivial module of there is a splitter . Furthermore, for any splitter of there are in such that .
Proof.
Indeed, cannot be a module of , as is a prime graph, so it must have a splitter in . Also note that is not a splitter of by definition of . Furthermore, since is a splitter it must be adjacent to some and non-adjacent to some . Since and are intervals of , we get that or by definition of the permutation diagram.
The following observation will allow to simplify the analysis.
Observation 19.
If induces a prime subgraph of , and is a splitter of , then we can both extract a pair of vertices of that are adjacent and split by , and a pair of vertices of that are non-adjacent and split by .
Proof.
Consider the cut in , since is prime both and are connected, yielding both an edge and an non-edge across .
Claim 20.
There cannot be disjoint non-trivial strong modules in .
Proof.
We proceed by contradiction and consider two maximal disjoint non-trivial strong modules of , without loss of generality . We first show that, in , and must have distinct splitters from , and then conclude that this contradicts the assumption that has a -contraction sequence respecting 17.
Using the fact that and are intervals of and the common interval characterisation of strong modules of given by 3, we deduce that a splitter , which necessarily belongs to , cannot split both and . Indeed, we have or , so if is a splitter of there exist such that as seen in the previous claim. In particular, is not a splitter of .
Now because and are non-trivial modules of , they each have a splitter in . Let and be such splitters. By maximality, and correspond to subtrees rooted at siblings of the same node in the modular decomposition of . Let us first consider the case when is a prime node. In this case, Lemma 7 guarantees a red edge for , and the two splitters forbid the existence of a contraction sequence with consecutivity properties as guaranteed by Lemma 11 and Corollary 15.
We may now assume that is a degenerate node, and exhibit an induced subgraph of that does not admit a -contraction sequence respecting our assumptions. This will contradict the existence of such a sequence for the whole , as its restriction to would also be valid (as in Observation 4). The graph consists of splitters , as well as two pairs of twins and distinguished by respectively. Then, vertices induce a cograph whose corresponding cotree is a complete binary tree of depth . In other words, and are present if and only if is adjacent to .
We first reduce and so as to induce exactly the quotient graph of their corresponding node in the modular decomposition (recall that this is well defined because they are strong) by picking one vertex in each subtree below this node. We may ensure that and still split this subset of vertices (e.g. by picking extremal vertices of the interval of corresponding to and , recalling 3).
Now we observe that if (resp. ) has a degenerate root node, it is of the opposite type of the node , and any pair of vertices of (resp. ) that is split by (resp. ) can be taken for our subgraph . Otherwise, (resp. ) has a prime root node, and we apply Observation 19 to obtain a pair of vertices that is split and has the required adjacency relation.
Let us now show that does not admit a -contraction sequence satisfying our assumptions. Indeed, and may only be contracted together, because they are the only vertices in of our subgraph (Claim 17), but they are split by at least two vertices in . Now, any order of contractions on will create two red edges. More precisely, contracting a vertex from each nontrivial module creates two red edges, unless one module was already reduced to a single vertex, in which case it has a red edge to its splitter from . This will inevitably contradict Lemma 7.
Claim 21.
If has a prime node in its modular decomposition, the first red edge must appear in the module corresponding to the subtree rooted at . In this case, has exactly one splitter from and should not be incident to a red edge until is contracted to a single vertex.
Proof.
Let be a prime node of the modular decomposition of and the module corresponding to the subtree rooted at . Without loss of generality assume . We first make the observation that, since there cannot be two disjoint nontrivial strong modules in by 20, and since prime graphs have at least vertices, there are vertices introduced by node .
We first consider the case when a red edge incident to a vertex of is created before we fully contract . This red edge has to remain incident to a vertex of due to Claim 17. Contracting a vertex introduced in prime node will create another red edge with both endpoints in , which is thus different and contradicts Lemma 7.
We now deal with the case where no red edge incident to a vertex of appears before we fully contract . Assume the first red edge does not have both endpoints in . Observe that the first contraction cannot be between vertices that are both not in but have a different adjacency to it because is a module on at least vertices, and this would create a red edge to all of them. Observe also that if the first contraction had involved a vertex of , there would also be a red edge with both endpoints in . Indeed, on the one hand, if both contracted vertices were in , red edges with both endpoints in would have both endpoints in because it is a module. On the other hand, is also a strong module with a prime node at its root, so all of its vertices have a mixed adjacency to the rest of , contrary to vertices outside . We conclude that the first contraction is between two vertices outside of , so the corresponding red edge has both endpoints outside of . This has the following implications: both contracted vertices have an homogeneous adjacency to , but they also have a unique splitter in , this implies we cannot contract the red edge before contracting the subgraph corresponding to . Indeed, the two vertices incident to the red edge must have opposite adjacency relations with respect to . Since contracting will force the creation of a second red edge, this contradicts Lemma 7.
is a non-trivial strong module of so it has at least one splitter in . From Lemma 7 and Claim 17, it follows that a red edge incident to this splitter cannot appear before is contracted to a single vertex. Finally, only one red edge may appear when is contracted to a single vertex meaning the splitter must be unique.
In particular, this shows that only one of and can have a prime node in their modular decomposition. We can moreover deduce that if there is a prime node in , it must be unique. Indeed, a red edge has to appear in some corresponding to the subtree of the prime node that is deepest in the modular decomposition of . At any step of the sequence, contains a red edge, until it is a single vertex with a red edge towards its splitter. Then, vertices introduced in any higher prime node cannot be contracted on such red edges without producing an additional red edge, which contradicts Lemma 7.
We are now ready to define . Consider the first red edge appearing between and in a -contraction sequence as considered, and assume without loss of generality that it stems from a contraction in . Then, can only consist in a single vertex due to Claim 17, Lemma 7, and the fact that this is the first red edge with an endpoint in both and . Then, is included in a module of which admits as unique splitter . In the case when there is no prime node, induces a cograph, so we may then take to be any pair of consecutive twins , which are also consecutive twins in by Corollary 15, distinguished by (because is prime and is the only splitter of ).
Otherwise, we can take and as guaranteed by 21 on and . The restriction of our contraction sequence to yields a -contraction sequence in which becomes incident to a red edge last, as desired.
Having defined , we are ready to show the following.
Claim 22.
There exists a -contraction sequence of that starts by contracting only vertices of until it is reduced to a single vertex. In particular, this creates a red edge towards at the last contraction.
Proof.
We can extend the contraction sequence that contracts first into a sequence contracting the smallest interval of containing because is not split by any splitter from other than , and it does not have disjoint non trivial strong modules. After contraction of to a single vertex, the remaining vertices of induce a cograph that is not split by any vertex of other than . We can then proceed with the rest of the contraction of simply by contracting remaining vertices according to our initial contraction sequence.
At this point, in both cases, we know forms a common interval for , and that there is some -sequence for that first contracts and in which is the last vertex to be incident to a red edge. We deduce that satisfies the setting of Corollary 15, and any further contractions must be consecutive to due to Corollary 15, ensuring the existence of .
The crucial observation now is that can easily be computed greedily using the realiser.
Lemma 23.
Given a permutation diagram of a prime permutation graph and an extremal vertex of , we can produce in time linear in the number of vertices of a -contraction sequence such that is the last vertex of to be incident to the red edge, or conclude that no such sequence exists.
Proof.
This is essentially an implementation of the result of Lemma 16, we reuse similar notations and provide an illustration in Figure 2. The algorithm works as follows.
We initialise indices at the endpoints of the intervals and of that are split by , and at the endpoints of the interval of . We add to the global list and mark it as a splitter.
While there is one endpoint of that is also an endpoint of or an endpoint of , we add to the global list and update indices describing and in accordance to the removal of . We call such a vertex doubly extremal.
If the intervals have become empty, return , otherwise, if either or contains a single vertex, we set to be this vertex and to be the other interval, and apply the algorithm recursively to with as the last vertex incident to a red edge. Finally, if both and contain more than one vertex, we reject.
We can use marked vertices to deduce a contraction sequence: we iterate through , starting from the last vertices added. When reaching a marked vertex, we contract the red edge. Otherwise, we contract the current vertex to the vertex of the red edge with the same adjacency to the next marked vertex.
If the algorithm does not reject, let us show by induction on the recursive calls that the list , along with its marked vertices, describes a valid order of contractions for . First, we clarify the starting red edge that we consider in the part of the contraction sequence built at this step of the recursion. In the case when we emptied and (so and are not defined), take the last vertex in and the last vertex in as a starting red edge. We move to the case where and are defined. Here, by induction hypothesis, the algorithm finds a -contraction sequence with as the last vertex incident to a red edge for . This contraction sequence for gives a partial -contraction sequence for (see Observation 4) yielding a red edge between and , with all other vertices of not contracted yet.
We now check that each vertex added to at this step can be contracted in the order described by . This is the case because the vertex does not split the vertices of contracted before it, nor the vertices of contracted before it. By contracting it to the vertex of the red edge with the same adjacency to , we create no additional red edge. In particular, is still not incident to a red edge. Once we contracted all vertices of and , the red edge can be safely contracted. Indeed, is the unique splitter of .
If the algorithm rejects, it contradicts the existence of guaranteed by Lemma 16. Indeed, if for all , the are intervals as claimed, it must be that for each , is extremal on and on for some . In particular, all vertices that are not in will become doubly extremal if exists. Note that this is independent of the order in which they are contracted. Indeed, a vertex remains (doubly) extremal while we delete other vertices.
We conclude that has twin-width more than .
Theorem 24.
We can decide in linear time if a given graph has twin-width at most .
Proof.
We first compute a modular decomposition of and realisers for the quotient graphs of prime nodes [24]111In fact, it would be more reasonable to compute a permutation diagram and deduce a modular decomposition via common intervals for a practical implementation., or conclude that is not a permutation graph and therefore not a graph of twin-width . It is well-known that the total size of the quotient graphs of prime nodes is linear in the size of the original graph.
We then check all prime nodes with corresponding quotient graph as follows:
Guess an extremal vertex (out of at most ) that can be the last vertex incident to the red edge in a -contraction sequence of , and then apply the recursive algorithm of Lemma 23.
If all prime nodes have twin-width , we obtained a contraction sequence for all of them and they can be combined to form a contraction sequence of using Corollary 6.
All of the above procedures can be implemented to run in linear time.
References
- [1] Jungho Ahn, Debsoumya Chakraborti, Kevin Hendrey, and Sang-il Oum. Twin-width of subdivisions of multigraphs, 2024. doi:10.48550/arXiv.2306.05334.
- [2] Jungho Ahn, Kevin Hendrey, Donggyu Kim, and Sang-il Oum. Bounds for the twin-width of graphs. SIAM J. Discret. Math., 36(3):2352–2366, 2022. doi:10.1137/21m1452834.
- [3] Jakub Balabán, Robert Ganian, and Mathis Rocton. Computing twin-width parameterized by the feedback edge number. In Olaf Beyersdorff, Mamadou Moustapha Kanté, Orna Kupferman, and Daniel Lokshtanov, editors, 41st International Symposium on Theoretical Aspects of Computer Science, STACS 2024, March 12-14, 2024, Clermont-Ferrand, France, volume 289 of LIPIcs, pages 7:1–7:19. Schloss Dagstuhl – Leibniz-Zentrum für Informatik, 2024. doi:10.4230/LIPICS.STACS.2024.7.
- [4] Jakub Balabán, Robert Ganian, and Mathis Rocton. Twin-width meets feedback edges and vertex integrity. CoRR, abs/2407.15514, 2024. doi:10.48550/arXiv.2407.15514.
- [5] Pierre Bergé, Édouard Bonnet, and Hugues Déprés. Deciding twin-width at most 4 is np-complete. In Mikolaj Bojanczyk, Emanuela Merelli, and David P. Woodruff, editors, 49th International Colloquium on Automata, Languages, and Programming, ICALP 2022, July 4-8, 2022, Paris, France, volume 229 of LIPIcs, pages 18:1–18:20. Schloss Dagstuhl – Leibniz-Zentrum für Informatik, 2022. doi:10.4230/LIPICS.ICALP.2022.18.
- [6] Anne Bergeron, Cédric Chauve, Fabien de Montgolfier, and Mathieu Raffinot. Computing common intervals of K permutations, with applications to modular decomposition of graphs. SIAM J. Discret. Math., 22(3):1022–1039, 2008. doi:10.1137/060651331.
- [7] Benjamin Bergougnoux, Jakub Gajarský, Grzegorz Guspiel, Petr Hlinený, Filip Pokrývka, and Marek Sokolowski. Sparse graphs of twin-width 2 have bounded tree-width. In Satoru Iwata and Naonori Kakimura, editors, 34th International Symposium on Algorithms and Computation, ISAAC 2023, December 3-6, 2023, Kyoto, Japan, volume 283 of LIPIcs, pages 11:1–11:13. Schloss Dagstuhl – Leibniz-Zentrum für Informatik, 2023. doi:10.4230/LIPICS.ISAAC.2023.11.
- [8] Édouard Bonnet, Ugo Giocanti, Patrice Ossona de Mendez, Pierre Simon, Stéphan Thomassé, and Szymon Torunczyk. Twin-width IV: ordered graphs and matrices. J. ACM, 71(3):21, 2024. doi:10.1145/3651151.
- [9] Édouard Bonnet, Eun Jung Kim, Amadeus Reinald, and Stéphan Thomassé. Twin-width VI: the lens of contraction sequences. In Joseph (Seffi) Naor and Niv Buchbinder, editors, Proceedings of the 2022 ACM-SIAM Symposium on Discrete Algorithms, SODA 2022, Virtual Conference / Alexandria, VA, USA, January 9 - 12, 2022, pages 1036–1056. SIAM, 2022. doi:10.1137/1.9781611977073.45.
- [10] Édouard Bonnet, Eun Jung Kim, Amadeus Reinald, Stéphan Thomassé, and Rémi Watrigant. Twin-width and polynomial kernels. Algorithmica, 84(11):3300–3337, 2022. doi:10.1007/s00453-022-00965-5.
- [11] Édouard Bonnet, Eun Jung Kim, Stéphan Thomassé, and Rémi Watrigant. Twin-width I: Tractable FO model checking. J. ACM, 69(1):Art. 3, 46, 2022. doi:10.1145/3486655.
- [12] Christian Capelle, Michel Habib, and Fabien de Montgolfier. Graph decompositions andfactorizing permutations. Discret. Math. Theor. Comput. Sci., 5(1):55–70, 2002. doi:10.46298/DMTCS.298.
- [13] Maria Chudnovsky, Neil Robertson, Paul Seymour, and Robin Thomas. The strong perfect graph theorem. Annals of Mathematics, 164(1):51–229, July 2006. doi:10.4007/annals.2006.164.51.
- [14] Derek G. Corneil, Michel Habib, Jean-Marc Lanlignel, Bruce A. Reed, and Udi Rotics. Polynomial-time recognition of clique-width 3 graphs. Discret. Appl. Math., 160(6):834–865, 2012. doi:10.1016/J.DAM.2011.03.020.
- [15] Derek G Corneil, Stephan Olariu, and Lorna Stewart. Asteroidal triple-free graphs. SIAM Journal on Discrete Mathematics, 10(3):399–430, 1997. doi:10.1137/S0895480193250125.
- [16] Fabien de Montgolfier. Décomposition modulaire des graphes. Théorie, extension et algorithmes. (Graph Modular Decomposition. Theory, extension and algorithms). PhD thesis, Montpellier 2 University, France, 2003. URL: https://tel.archives-ouvertes.fr/tel-03711558.
- [17] Ben Dushnik and E. W. Miller. Partially ordered sets. American Journal of Mathematics, 63(3):600–610, July 1941.
- [18] Tibor Gallai. Transitiv orientierbare graphen. Acta Mathematica Academiae Scientiarum Hungaricae, 18:25–66, 1967. German.
- [19] Colin Geniet and Stéphan Thomassé. First order logic and twin-width in tournaments. In Inge Li Gørtz, Martin Farach-Colton, Simon J. Puglisi, and Grzegorz Herman, editors, 31st Annual European Symposium on Algorithms, ESA 2023, September 4-6, 2023, Amsterdam, The Netherlands, volume 274 of LIPIcs, pages 53:1–53:14. Schloss Dagstuhl – Leibniz-Zentrum für Informatik, 2023. doi:10.4230/LIPICS.ESA.2023.53.
- [20] M.C. Golumbic. Algorithmic graph theory and perfect graphs. Academic Press, 1980.
- [21] Sylvain Guillemot and Dániel Marx. Finding small patterns in permutations in linear time. In Chandra Chekuri, editor, Proceedings of the Twenty-Fifth Annual ACM-SIAM Symposium on Discrete Algorithms, SODA 2014, Portland, Oregon, USA, January 5-7, 2014, pages 82–101. SIAM, 2014. doi:10.1137/1.9781611973402.7.
- [22] Michel Habib and Christophe Paul. A survey of the algorithmic aspects of modular decomposition. Comput. Sci. Rev., 4(1):41–59, 2010. doi:10.1016/J.COSREV.2010.01.001.
- [23] Ekkehard Köhler. Graphs Without Asteroidal Triples. PhD thesis, Technischen Universität Berlin, 1999.
- [24] Ross M. McConnell and Jeremy P. Spinrad. Modular decomposition and transitive orientation. Discret. Math., 201(1-3):189–241, 1999. doi:10.1016/S0012-365X(98)00319-7.
- [25] Szymon Torunczyk. Flip-width: Cops and robber on dense graphs. In 64th IEEE Annual Symposium on Foundations of Computer Science, FOCS 2023, Santa Cruz, CA, USA, November 6-9, 2023, pages 663–700. IEEE, 2023. doi:10.1109/FOCS57990.2023.00045.