Recoloring graphs via tree decompositionsThe authors are supported by the ANR Grant EGOS (2012-2015) 12 JS02 002 01.

# Recoloring graphs via tree decompositions††thanks: The authors are supported by the ANR Grant EGOS (2012-2015) 12 JS02 002 01.

Marthe Bonamy, Nicolas Bousquet
LIRMM, Université Montpellier 2, CNRS
{marthe.bonamy, nicolas.bousquet}@lirmm.fr
###### Abstract

Let be an integer. Two vertex -colorings of a graph are adjacent if they differ on exactly one vertex. A graph is -mixing if any proper -coloring can be transformed into any other through a sequence of adjacent proper -colorings. Jerrum proved that any graph is -mixing if is at least the maximum degree plus two. We first improve Jerrum’s bound using the grundy number, which is the worst number of colors in a greedy coloring.

Any graph is -mixing, where is the treewidth of the graph (Cereceda 2006). We prove that the shortest sequence between any two -colorings is at most quadratic (which is optimal up to a constant factor), a problem left open in Bonamy et al. (2012).

We also prove that given any two -colorings of a cograph (resp. distance-hereditary graph) , we can find a linear (resp. quadratic) sequence between them. In both cases, the bounds cannot be improved by more than a constant factor for a fixed . The graph classes are also optimal in some sense: one of the smallest interesting superclass of distance-hereditary graphs corresponds to comparability graphs, for which no such property holds (even when relaxing the constraint on the length of the sequence). As for cographs, they are equivalently the graphs with no induced , and there exist -free graphs that admit no sequence between two of their -colorings.

All the proofs are constructivist and lead to polynomial-time recoloring algorithms.

Keywords: Reconfiguration problems, vertex coloring, treewidth, distance-hereditary, cograph, grundy number.

## 1 Introduction

Reconfiguration problems (see [13, 16, 17] for instance) consist in finding step-by-step transformations between two feasible solutions such that all intermediate results are also feasible. Such problems model dynamic situations where a given solution is in place and has to be modified, but no property disruption can be afforded. In this paper our reference problem is vertex coloring.

In the whole paper, is a graph where denotes the size of and is an integer. For standard definitions and notations on graphs, we refer the reader to [12]. A (proper) -coloring of is a function such that, for every edge , . The chromatic number of a graph is the smallest such that admits a -coloring.

Two -colorings are adjacent if they differ on exactly one vertex. The -recoloring graph of , denoted and defined for any , is the graph whose vertices are -colorings of , with the adjacency defined above. Note that two colorings equivalent up to color permutation are distinct vertices in the recoloring graph. The graph is -mixing if is connected. Cereceda, van den Heuvel and Johnson characterized the -mixing graphs and provided an algorithm to recognize them [9, 10]. The easiest way to prove that a graph is not -mixing is to exhibit a frozen -coloring of , i.e. a coloring in which all vertices are adjacent to vertices of all other colors. Such a coloring is an isolated vertex in .

Deciding whether a graph is -mixing is -complete for  [7]. The -recoloring diameter of a -mixing graph is the diameter of . In other words, it is the minimum for which any -coloring can be transformed into any other through a sequence of at most adjacent -colorings. The mixing number of is the minimum integer for which is -mixing for every . It can be arbitrarily larger than the minimum for which is -mixing [8] (thus arbitrarily larger than its chromatic number). Indeed, for complete bipartite graphs minus a matching, the chromatic number equals two, any 3-coloring can be transformed into any other through a linear sequence of 3-colorings if there are at least four vertices on each side of the bipartition, and the mixing number is arbitrarily large (see Fig. 1). Throughout the paper, our goal is to determine bounds on the mixing number of graphs and prove that the corresponding recoloring diameter is polynomial. Note that there exists a family of graphs for which there are two colorings that can be transformed one into the other but not through a polynomial sequence [7].

Jerrum [18] proved that , where denotes the maximum degree of . Let be an order on . We denote by the neighborhood of . In the greedy coloring of relative to , every has the smallest color that does not appear in . Introduced in [11], the grundy number is the maximum, over all the orders , of the number of colors used in . So is the worst number of colors in a greedy coloring of . In Section 3, we prove that any graph is -mixing in linear time. The corresponding diameter is at most , and we give a polynomial-time algorithm to find a sequence of length at most .

###### Theorem 1.

For any graph , if , then is -mixing and the -recoloring diameter is at most .

Theorem 1 improves Jerrum’s bound since and can be arbitrarily smaller, on stars for instance.

Besides, the bound is tight on complete bipartite graphs minus a matching [8] (see Figure 1). Indeed, since if both and are given the same color for every , the resulting coloring is an -coloring for which no vertex can be recolored. However, is not lower-bounded by a function of since for any , some tree satisfies and  [3]. In addition, unlike the maximum degree, the grundy number is NP-hard to compute [21].

Given a graph and an integer , it is NP-complete to decide if  [2]. Nevertheless, for every fixed , there is a linear-time algorithm to decide if the treewidth is at most (and find a tree decomposition) [4]. Graphs of treewidth , being -degenerate, are -mixing [8]. However, the best upper-bound known on the recoloring diameter is exponential. In Section 4, we prove that the recoloring diameter is polynomial for bounded treewidth graphs, a problem left open in [6].

###### Theorem 2.

For every graph , if , then is -mixing and its -recoloring diameter is at most .

Section 4 is devoted to a proof of Theorem 2, which is independent from Theorem 1. The quadratic upper bound on the recoloring diameter was known for chordal graphs [6], but its generalization to bounded treewidth graphs was left open. As shown in the case of chordal graphs [6] (which is a subclass of graphs of treewidth ), the mixing number is tight, and the recoloring diameter is tight up to a constant factor. The existence of a polynomial recoloring diameter in the case of -degenerate graph is still open and will be discussed in Section 6. A sketch of the proofs of Theorem 1 and 2 were published in the extended abstract of LAGOS’13 [5].

The last main results of this paper deal with cographs and distance-hereditary graphs. The class of cographs is the class of -induced free graphs, i.e. the class of graphs that do not contain a path on four vertices as an induced subgraph. By Theorem 1, we obtain the following:

###### Corollary 3.

For every cograph , if , then is -mixing and its -recoloring diameter is at most .

Indeed, the grundy number of cographs is equal to their chromatic number [14]. Recall that cographs are -free graphs. Can we generalize this result to the class of -free graphs for any fixed ? It is easy to answer negatively to this question by observing that complete bipartite graphs minus a matching (see Fig. 1) are -free graphs and that the mixing number of such graphs is arbitrarily large. We can build an ad-hoc -free graph with chromatic number which is not -mixing (see Fig. 2). In fact, we can even build a family of -free graphs that admit both a -coloring and a frozen -coloring, as follows. Take a clique , remove all edges , add for all a vertex adjacent to all the ’s except . We obtain a -coloring by setting for all and for all such that exists, and a frozen -coloring by setting and for all . Not all edges are necessary, but it is easier that way to verify that there is indeed no induced .

Note that, since the -recoloring diameter of the class of induced paths is quadratic [6], only graph classes excluding long paths can have a linear recoloring diameter. Corollary 3 ensures that -free graphs admit a linear recoloring diameter. So we raise the following question: does the class of -free graphs with mixing number have a linear recoloring diameter?

Using a slight generalization of cographs, we finally prove in Section 5 that distance-hereditary graphs admit a quadratic recoloring diameter.

###### Theorem 4.

For every distance-hereditary graph and every , the graph is -mixing and it recoloring diameter is at most .

Once again, since distance-hereditary graphs contain long paths, the upper bound on the recoloring diameter is optimal up to a constant factor. Since the mixing number of complete bipartite graph minus a matching is not bounded by a function of the chromatic number, neither is it the case for any graph class containing them, thus for comparability graphs, perfectly orderable graphs, and then perfect graphs, answering a question of [6]. Considering that comparability graphs form the smallest interesting superclass of distance-hereditary graphs, Theorem 4 is in some sense optimal with regards to the graph class, as it is optimal as to the bound on the recoloring diameter.

Finally note that all our results are also algorithmic. Indeed each proof can be adapted into a polynomial-time algorithm that will find a short recoloring sequence. The one exception is for bounded treewidth graphs. Indeed determining the treewidth of a graph is an -hard problem. Nevertheless, for every fixed , deciding whether the treewidth of the graph is at most (and if so, producing a corresponding tree decomposition) can be done in linear time [4].

## 2 Preliminaries

Let us first recall some classical definitions on sets. Let and be two subsets of . The set is the subset of elements such that . By abuse of notation, given a set and an element , denotes and will sometimes be denoted by . The size of is its number of elements.

Let be a graph. For any coloring of , we denote by the set of colors used by on the subgraph of . The neighborhood of a vertex , denoted by is the subset of vertices such that . The length of a path is its number of edges. The distance between two vertices and , denoted , is the minimum length of a path between these two vertices. When there is no path, the distance is infinite. The distance between two -colorings of is implicitely the distance between them in the recoloring graph . Let us first recall a classical result on recoloring.

###### Lemma 5.

If , any -coloring of can be transformed into any other by recoloring every vertex at most twice.

###### Proof.

Let be two colorings of . Assume is initially colored in . We plan to recolor into while recoloring each vertex at most twice. Let be the digraph on vertices with an arc if is currently colored in . Informally is an arc if the current color of prevents the recoloring of into its final color (in ). The coloring of is proper at any time: no two vertices are colored identically, so . The same argument holds for , so . Hence is a disjoint union of directed paths and of circuits.

We recolor every directed path as follows. Let be a directed path. Then , and we can recolor into its final color in . Then , and we recolor into its final in . We repeat that operation until is recolored. Now every vertex of the directed path is an isolated vertex in , since no two vertices are colored identically in .

Let be a circuit. Since , can be recolored with a free color. After this recoloring, we have , so becomes a directed path, which we recolor as such. We then recolor into . Now every vertex of circuit is an isolated vertex in . We repeat that operation until no circuit remains in . Since we already recolored every directed path and was initially a disjoint union of directed paths and circuits, the clique is now colored in . ∎

## 3 Mixing number and grundy number

This section is devoted to a proof of Theorem 1, which is derived from the following lemma.

###### Lemma 6.

Let be a graph on vertices, and . For any -coloring of and any grundy -coloring of , we have .

###### Proof.

Let us prove it by induction on . If , has no edge and in steps, we can transform into . Assume now that . For any integer and any coloring , is the set of vertices of color in . Iteratively on from to , we recolor the vertices of with the smallest color for which the coloring is still proper. The resulting coloring of is the greedy coloring relative to the order . Hence is an (at most) -coloring. In addition, , since no vertex is recolored twice. Since no vertex is colored with in and , we recolor vertices of with color . We then recolor vertices of with if needed. The resulting coloring satisfies . In addition, , since no vertex is recolored twice. Let us now prove that the induction hypothesis holds on with , , and . We have . Indeed, assume that there is an order on such that . Consider the order on . Every vertex of has a neighbor on (since is grundy), so the greedy coloring relative to needs colors for , a contradiction. We also have . Indeed, for the order on corresponding to , the greedy coloring of relative to requires at least colors. So we can apply the induction hypothesis on with , , and (the color is forgotten, thus a greedy coloring will start with color , and is an grundy coloring of ). This ensures that can be recolored in steps. Consequently, . ∎

Finally, we consider a graph on vertices, an integer , and two -colorings and of . By definition of the chromatic number, we know there exists a grundy -coloring of . Since, , Lemma 6 ensures that . However, finding a grundy -coloring of is NP-complete. For a polynomial-time algorithm, we can derive from a grundy coloring in at most steps, and apply Lemma 6 on and , to obtain that .

## 4 Bounded treewidth graphs

The aim of this section is to prove Theorem 2. A tree is a connected graph without cycles. To avoid confusion, its vertices are called nodes. A tree decomposition of is a tree such that:

• To every node of , we associate a bag .

• For every edge of , there is a node of such that both and are in .

• For every vertex , the set of nodes of whose bags contain forms a non-empty subtree in .

The size of a tree decomposition is the largest number of vertices in a bag of , minus one. The treewidth of is the minimum size of a tree decomposition of .

A chordal graph is a graph that admits a perfect elimination ordering: that is, the vertices of the graphs can be ordered in such a way that the neighborhood of any vertex in forms a clique. Any chordal graph admits a tree decomposition whose bags are the maximal cliques of .

Actually, any tree decomposition of a graph can be viewed as a chordal graph with vertex set that admits as a subgraph ( is a supergraph of ). Informally, we transform step-by-step any -coloring of a graph into a -coloring of a ”good” chordal supergraph with the same treewidth.

We first introduce particular tree decompositions, called complete tree decompositions. In such decompositions, all the bags have exactly the same size and any two adjacent bags differ on exactly one vertex. Two vertices are parents if their subtrees are, in some sense, adjacent. A -coherent coloring is a coloring where parents are colored identically, i.e. a coloring of the vertices that is compatible with the chordal supergraph corresponding to the complete tree decomposition.

The proof is divided into two parts. First we prove that the distance between -coherent colorings is linear. We then prove that any coloring can be transformed into a -coherent coloring with a quadratic number of recoloring steps as long as the number of colors is at least .

### 4.1 Families

A tree decomposition of a graph is -complete when every bag has size and any two adjacent nodes satisfy . In other words, for every edge of , there exists a vertex such that . For any subtree of , denotes . Let . The tree decomposition is the same tree as except that the bag of every node is , and that every edge of is contracted if . In Fig. 3, the full-line edges subtree is . The following remark is an immediate consequence of the definition of complete tree decomposition.

###### Remark 1.

Any connected subtree of an -complete tree decomposition is still -complete.

A baby is a vertex of that appears in exactly one bag , where is a leaf of . Note that all the neighbors of a baby are in . In Fig. 3, vertex is a baby.

###### Remark 2.

Let be an -complete tree decomposition. If is a baby then is -complete.

###### Proof.

Let be the unique node whose bag contains . Then the only modified bag in is . Let be the father of in . Since is complete, in , so the edge is contracted in . Therefore is exactly which is -complete by Remark 1. ∎

We first prove that every graph admits complete tree decompositions. Then we derive from it the notion of parents and family between vertices of .

###### Lemma 7.

For every graph , if then admits an -complete tree decomposition.

###### Proof.

By definition of , the graph admits a tree decomposition whose every bag has size at most . We can assume w.l.o.g. that no bag is contained in another in : if two adjacent nodes in verify , then the edge can be contracted.

We build inductively an -complete tree decomposition of such that every bag of is contained in a bag of .

If , then the tree decomposition consisting of a single node with bag is -complete.

If , then has at least two nodes since every vertex is contained in at least one bag. Let be a leaf of and be the neighbor of . Since no bag is contained in another in , there is a vertex in . Note that is a baby. Otherwise the subset of nodes whose bags contain would not be a subtree of since and is the unique neighbor of in . Let .

By induction hypothesis, admits an -complete tree decomposition where every bag of is contained in a bag of . So some node of satisfies . Since , some vertex of is not in . We consider built from by adding a leaf attached on whose bag is . Then is an -complete tree decomposition of with the required property with regards to . ∎

Let be a complete tree decomposition. Note that for every edge . Two vertices are -parents if there are two adjacent nodes of such that , and . In other words, vertices and are -parents if the subtree of the nodes containing in their bags and the subtree of the nodes containing in their bags do not intersect, but are connected by an edge ( in this case). When no confusion is possible we will use the term parents instead of -parents. Also note that the notion of parents is symmetric: if is a parent of then is a parent of . The family relation is the transitive closure of the parent relation. A family is a class of the family relation. In Fig. 3, the families are and . The partition of induced by the families is called the family partition. In Fig. 3, vertices and are parents.

###### Remark 3.

The family partition of any -complete tree decomposition exists and is unique. Each family contains exactly one vertex in every bag. So there are families, which are stable sets.

###### Proof.

By induction on . If has a single node , then no vertex has a parent. So each family is a single vertex. Assume has at least two nodes. Let be a leaf of and be its adjacent node. Note that the family partitions of are the extensions of those of . The vertices and are parents and is the unique parent of . Since is a leaf of , is still -complete by Remark 1.

By induction, contains exactly one vertex of every family of the unique family partition of . Since , and since is the unique parent of , we can uniquely extend the partition by adding in the family of . Besides, in there is exactly one vertex of each family. ∎

### 4.2 Coherent colorings

Let be an -complete tree decomposition of a graph . A coloring is -coherent (relatively to ) if for every that are parents, and for every bag and every , only is colored with in . Note that since parents are non-adjacent in the graph by Remark 3, coherent colorings can be proper. Note that a -coherent coloring is a proper -coloring which is in some sense canonical: given two -coherent colorings, they differ only up to a color permutation. Our recoloring algorithm consists in transforming any coloring into such a canonical coloring. Then we can transform any -coherent coloring into any other using the recoloring algorithm of the clique.

The subsection is organized as follows. First we define the notion of merging. Then we prove that the distance between -coherent colorings is linear. And we finally provide some recoloring lemmas regarding -coherent colorings. All these tools will be used in Section 4.3.

Let be a graph and be a stable set. The merged graph on is the graph where vertices of are identified into a vertex and is an edge if there exists a vertex such that is an edge. A coloring of the merged graph can be extended on the whole graph by coloring every vertex of with . For any stable sets with for any , the merged graph on is the graph obtained from by merging successively .

###### Remark 4.

Let be a stable set. Let be two colorings of the merged graph on and be their extended colorings. If can be transformed into by recoloring each vertex at most times, then can be transformed into by recoloring every vertex at most times.

###### Proof.

We just have to follow the recoloring process of into . If the recolored vertex is not , then perform the same recoloring in the extended graph. Otherwise, recolor the vertices of (one after the other) into the new color of in the extended graph. All the intermediate colorings are proper since is a stable set. ∎

Remark 4 formalizes an easy fact: when there is a set of a same color, then we can consider it as a single vertex.

###### Remark 5.

Let be an -complete tree decomposition, let be a stable set of that belongs to the same family and let be the merged graph on . If is connected, then for the tree obtained from by contracting any edge such that and differ only on vertices of , is an -complete tree decomposition of .

###### Proof.

By induction on .

If , and are actually and , so the result holds.

If , since is connected, for , and are parents. Let be the merged graph on and be the tree obtained from by contracting any edge such that and differ only on vertices of . The set of nodes of whose bags contain or forms a non-empty subtree of , so the same holds of . Then the tree is a tree decomposition of . The tree decomposition is still -complete since every bag of corresponds to (at least) a bag of , and any two adjacent nodes in correspond to two adjacent nodes in .

If , we consider a leaf of . We apply the induction hypothesis with : we obtain the graph and the -complete tree decomposition . Let be the vertex of corresponding to . Note that belongs to the same family as . Since is connected, so is . We apply the induction hypothesis on and with . The resulting graph and -complete tree decomposition are also the graph and tree decomposition that would have been obtained by merging directly on . ∎

###### Lemma 8.

Let . If every -coloring of can be transformed into a -coherent coloring with at most recolorings, then the -recoloring diameter of is at most .

###### Proof.

Let be two -colorings of . By assumption, there are two -coherent colorings and such that and .

Let us prove that . By definition, all the vertices of a same family are colored identically in . The same holds for . Let be the merged graph where every family is identified into a same vertex. By Remark 3, the family partition is unique, so both and are extensions of and colorings of . Every pair of vertices of have distinct colors in (and in ). So can be considered as a clique on vertices (since there are families). Lemma 5 and Remark 4 ensure that . Since , Lemma 8 holds. ∎

Let us first make some observations for the two forthcoming lemmas. Let be a tree and be a node of . We can consider that is rooted on . Then is the father of if is an edge and is not in the connected component of in . The tree rooted on , denoted by , is the connected component of in . Note that if is an -complete tree decomposition, then so is for any . Let us first prove some stability on -coherent colorings. This slightly technical lemma is at the core of the recoloring algorithm.

###### Lemma 9.

Let be an -complete tree decomposition rooted at and let be a node of distinct from . Let be a -coherent coloring where color does not appear in .
If a vertex of is colored with , every bag of contains a vertex colored with .

###### Proof.

Assume by contradiction that a node of does not contain a vertex colored with in its bag. Choose in such a way is as near as possible from in . Then the father of contains a vertex of color . The vertex is not in since . Let . We have since and is the father of . So and are parents. Since is -coherent, we have . But , a contradiction. ∎

###### Lemma 10.

Let be two integers with . Let be an -complete tree decomposition rooted on . Let be a -coherent -coloring where some color does not appear in .

Then by recoloring every vertex of at most once, we can obtain a -coherent -coloring where no vertex is colored with .

###### Proof.

Let us prove it by induction on . Given a subset of vertices of , two vertices are in the same -family if they are in the closure relation of the parents relation restricted to the vertices of (note that if the two notions coincide). For every ()-family , we merge all the vertices of . Since the coloring is -coherent, it makes sense: all the vertices of were colored identically. By Remark 5, the resulting tree decomposition is still -complete. By Remark 4, recoloring the resulting graph suffices: the resulting coloring will be -coherent in any case.

If , then the graph has no edge. Color can be eliminated by recoloring every vertex at most once since the graph is a stable set.

If , for every son of , we proceed as follows. If a vertex of is colored with then it is necessarily the vertex . We consider two cases depending on whether .

• Assume . Since is smaller than , by the induction hypothesis we can recolor without recoloring any vertex of (and then of ), so as to obtain a -coherent coloring with no vertex of color .

• Assume . By Remark 3, every node of contains exactly one vertex of the same family as . Since we merged on the families of , vertex belongs to every node of . Thus is an -complete tree decomposition of , and color does not appear on . We remove color from the set of available colors. Since is -coherent, it is in particular -coherent. Take a color that does not appear on . We apply the induction hypothesis on with , and color . Every vertex of has been recolored at most once, and by assumption, neither color nor appears on this set. We recolor in . Since , every vertex of has been recolored at most once, and color does not appear in .

By Remark 4, the resulting coloring is de facto -coherent. Every vertex has been recolored at most once, no vertex of has been recolored, and no vertex is colored in . ∎

### 4.3 Obtaining a V-coherent coloring

In order to prove Theorem 2, Lemma 8 ensures that we just have to transform any coloring into a -coherent coloring in at most steps. We will consider the vertices one after the other and we will try to obtain a coloring that is coherent when restricted to the vertices already treated. The recoloring algorithm is detailed in the following lemma:

###### Lemma 11.

Let be a -complete tree decomposition. For every -coloring of , there is a -coherent coloring such that .

###### Proof.

The proof consists in a recoloring algorithm. We treat vertices one after the other, considering vertices that have at most one parent not yet treated. In other words, we treat babies of the remaining tree-decomposition. Our invariant will ensure that, when is treated, the current coloring is -coherent. When a new vertex is treated, we just have to transform the current coloring in order to obtain a -coherent coloring. At the end of the procedure, the whole vertex set is treated, and then the current coloring is -coherent.

Let us now describe more formally the invariants. The set represents treated vertices at step . Initially, no vertex is treated, so . The coloring is the current -coloring at the end of step . Initially the coloring is , so . The invariants at the end of step are:

1. , and .

2. is a -complete tree decomposition of .

3. is an -coloring of obtained from by recoloring vertices of at most twice.

4. is -coherent.

We proceed iteratively on from to . Let be a leaf of and be a baby contained in . In Fig. 3, the node is a leaf of and is the corresponding baby. We want to add in . Denote by the set . By Remark 2 and since is a baby, is a complete tree decomposition. Thus (i) and (ii) are immediately verified. The following consists in proving (iii) and (iv).

A residual component of is a connected component of . Informally, a residual component is a subtree of the tree decomposition containing at least one treated vertex. A residual component of is a residual component containing a node adjacent to . Note that vertices which appear in a bag of such a residual component are included in . In Fig. 3, subtrees and are the residual components of in .

Let be the union of the residual components on . And let be the subtree induced by rooted on . Let us consider the graph restricted to the vertices of . Let be a color which does not appear in . Note that the coloring restricted to is -coherent. Indeed, the vertices of are in , and the coloring is -coherent.

By applying Lemma 10, can be transformed into a -coherent coloring of where no vertex is colored with . Every vertex of is recolored at most once. Note that since vertices of are not recolored, the obtained coloring is proper on the whole graph. Since is still in the clique tree, it means that no vertex of is in . So if two vertices of are parents, either they are both in or none is in . So the resulting coloring is -coherent.

At this point, the color has disappeared from and the coloring is -coherent. So all the members of the family of that are in can be recolored with , as the vertex itself. Every vertex is recolored at most once. Finally every vertex is recolored at most twice. So the resulting coloring satisfies conditions (iii) and (iv).

This operation is repeated until , that is, . When the last vertex is treated the coloring is -coherent by (iv). It follows from (iii) that to recolor from to , it suffices to recolor each vertex at most , where is the smallest such that . Thus, on the whole, it suffices to make recolorings. Actually, the analysis can be slightly improved. Indeed, the vertex treated at step is recolored at most once (since vertices of are not recolored in Lemma 10). Therefore, every vertex is recolored at most times, which finally ensures that . ∎

Note that the proof is totally algorithmic and runs in polynomial time (for a fixed number of colors).

## 5 Cographs and distance-hereditary graphs

In this Section, the notion of modules will be essential. Given a graph , a subset of vertices is a module if, for every vertex then is adjacent to either every vertex of or none of them. A subset of vertices is a strong module if and for every module of , and are either disjoint or contained one in the other. In this section, the total order on the colors is the standard order on the integers.

###### Remark 6.

For every graph, any three strong modules and such that satisfy .

###### Proof.

Assume by contradiction that three strong modules such that satisfy . There is no edge between any vertex of and . Indeed otherwise must be connected to every vertex of since is a module. And thus , a contradiction.

Therefore is a module of . Indeed, they have the same neighborhood in since is a module and the same neighborhood in since there is no edge beween and . Though, strictly intersects with , a contradiction since is a strong module. ∎

###### Remark 7.

For every graph , every vertex belongs to at most distinct strong modules.

###### Proof.

Since every strong module containing intersects any other on , all of them are included the ones into the others by definition of strong modules. Since the chromatic number of a module is at most , Remark 6 ensures that is contained in at most strong modules. ∎

### 5.1 Cographs and quasi-cographs

A graph is a cograph [19] if it does not contain induced paths of length . Equivalently, a graph is a cograph if:

• is a single vertex.

• Or can be partitionned into such that and are cographs and there is no edge between any vertex of and any vertex of .

• Or can be partitionned into such that and are cographs and every vertex of is adjacent to every vertex of (such an operation is called a join).

Note in particular that in the two last constructions, both subsets and are modules. In addition, in the second (resp. third) construction, is a strong module of iff it is not the disjoint union (resp. join) of two cographs. It follows that in a cograph, all the strong modules are a single vertex or the disjoint union of strong modules, or the join of strong modules. The cographs have been introduced in 1971 and have been extensively studied (see [1]).

A coloring of a cograph is said to be modular if for every strong module of that is the disjoint union of strong modules , the coloring uses a set of exactly colors on the set , and every is colored in with the first colors in . Partially joining a clique to a graph means taking a non-empty subset of and joining it to the graph.

A quasi-cograph rooted in , where is a cograph, is the graph obtained by partially joining cliques to modules of such that no two ’s strictly overlap. By partially joining, we mean that some vertices of the clique are totally connected to the module and others are not connected. Note that may be equal to , so cographs are in particular quasi-cographs rooted in themselves. Note also that two ’s might be identical. In other words, a quasi-cograph is obtained from a cograph by adding pending cliques on non-strictly overlapping modules of the cograph (see Figure 4). Given a subset of vertices of , the vertices rooted in are the vertices of the quasi cograph which are not in and connected to a vertex of . By extension, a modular coloring of a quasi-cograph is a coloring of it whose restriction to the underlying cograph is modular.

In order to prove the bounds on the mixing numbers of cographs and distance-hereditary graphs, we will first prove a few recoloring properties on quasi-cographs. Before stating the recoloring results, let us recall interesting properties of modules in cographs.

###### Claim 1.

A cograph that admits no non-trivial strong module is either a clique or a stable set.

###### Proof.

By induction on .

• If is a single vertex, the result holds.

• If is the disjoint union of two cographs and . A non-trivial strong module of (resp. ) is a strong module of , thus by the induction hypothesis, both and are either a clique or a stable set. Since is not a stable set, assume w.l.o.g. that is a clique (of size at least ). Then is a strong module of (indeed a module containing a strict subset of does not contain a vertex of ), a contradiction.

• If is the join of two cographs and . Similarly, we can assume that is a stable set, which implies that is a strong module of , a contradiction.

We start with an easy lemma:

###### Lemma 12.

Let be a quasi-cograph rooted in and . Every -coloring of can be recolored into a modular coloring with by recoloring every vertex at most times, while using no color on beside .

###### Proof.

Then is a graph obtained by partially joining cliques to modules of such that no two ’s strictly overlap.

Let be a smallest strong module of such that is not modularly colored. Thus every maximal strong module of strictly included in is modularly colored: we consider these strong modules to behave as a clique (where each color class corresponds to a single vertex) which is possible by Remark 4 (all the vertices of the same color class are merged which ensure that any recoloring is still a modular coloring for these modules). If was the join of strong modules, it is now a clique and its coloring is necessarily modular. Then was the disjoint union of cliques . Since is a strong module, every that intersects but does not contain it is strictly included in . Since is a module, if is strictly included in then is either strictly included in some , or is a union of ’s.

Let be a minimal included in that is not minimally colored, or itself if there is no such . The ’s strictly included in are considered to behave as cliques (again, where each color class is merged into a single vertex). We denote the resulting (at least two) disjoint cliques in . Note that all the cliques partially joined to a strict subset of are partially joined to some strictly included in and thus to a subset of some . Let be the colors used on , in that order (i.e. with ). For every from to , for each with , we pick a vertex that is colored with a color larger than , if any.

We then recolor if needed the pending cliques on some subset of