Coloring Reconfiguration Under Color Swapping
Abstract
In the Coloring Reconfiguration problem, we are given two proper -colorings of a graph and asked to decide whether one can be transformed into the other by repeatedly applying a specified recoloring rule, while maintaining a proper coloring throughout. For this problem, two recoloring rules have been widely studied: single-vertex recoloring and Kempe chain recoloring. In this paper, we introduce a new rule, called color swapping, where two adjacent vertices may exchange their colors, so that the resulting coloring remains proper, and study the computational complexity of the problem under this rule. We first establish a complexity dichotomy with respect to : the problem is solvable in polynomial time for , and is -complete for . We further show that the problem remains -complete even on restricted graph classes, including bipartite graphs, split graphs, and planar graphs of bounded degree. In contrast, we present polynomial-time algorithms for several graph classes: for paths when , for split graphs when is fixed, and for cographs when is arbitrary.
Keywords and phrases:
Combinatorial reconfiguration, graph coloring, PSPACE-complete, graph algorithmFunding:
Rin Saito: Supported by JST SPRING Grant Number JPMJSP2114.Copyright and License:
2012 ACM Subject Classification:
Theory of computation Graph algorithms analysisEditors:
Ho-Lin Chen, Wing-Kai Hon, and Meng-Tsung TsaiSeries and Publisher:
Leibniz International Proceedings in Informatics, Schloss Dagstuhl – Leibniz-Zentrum für Informatik
1 Introduction
1.1 Reconfiguring of Colorings
The field of combinatorial reconfiguration investigates reachability and connectivity in the solution space of combinatorial problems. A combinatorial reconfiguration problem is defined with respect to a combinatorial problem and a reconfiguration rule R, which specifies how one feasible solution of can be transformed into another. Given an instance of and two feasible solutions, the reconfiguration problem asks whether it is possible to transform one into the other through a sequence of solutions, each obtained by a single application of R, such that all intermediate solutions are also feasible. Combinatorial reconfiguration problems naturally arise in applications involving dynamic systems, where solutions must be updated while maintaining feasibility at every step. In addition, studying such problems provides deeper insights into the structural properties of the solution spaces of classical combinatorial problems. We refer the reader to the surveys by van den Heuvel [20] and Nishimura [31] for comprehensive overviews of this growing area.
Among the various reconfiguration problems, one of the most fundamental and extensively studied is the reconfiguration of graph colorings. Let be a positive integer. For a fixed reconfiguration rule R, the Coloring Reconfiguration problem under R is defined as follows: given a -colorable graph and two proper -colorings and , determine whether there exists a sequence of proper -colorings of starting at and ending at , where each coloring in the sequence is obtained from the previous one by a single application of R. The -Coloring Reconfiguration is a special case where is fixed. The computational complexity of -Coloring Reconfiguration has been the subject of extensive algorithmic study; see Section 3 of the survey by Mynhardt and Nasserasr [30].
Two reconfiguration rules have been widely studied for -Coloring Reconfiguration: single-vertex recoloring and Kempe chain recoloring. In the single-vertex recoloring rule, a new proper -coloring is obtained by recoloring a single vertex so that the resulting -coloring remains proper. Under this rule, -Coloring Reconfiguration is solvable in polynomial time when [14], while it becomes -complete for every fixed [8]. Notably, this rule is closely related to Glauber dynamics in statistical physics, where a Markov chain is defined over the space of proper -colorings of a graph : at each step, a vertex is selected uniformly at random and recolored with a randomly chosen color such that the resulting coloring remains proper. See Sokal [33] for an introduction to the Potts model and its connections to graph coloring.
The second widely studied rule is Kempe chain recoloring. A new proper -coloring is obtained by selecting a connected component of the subgraph of induced by two color classes (i.e., a Kempe chain) and swapping the two colors within . Note that when consists of a single vertex, this operation is equivalent to single-vertex recoloring. While -Coloring Reconfiguration under this rule is solvable in polynomial time when [27] (in fact, the answer is always “Yes”), it becomes -complete for every fixed [6]. Kempe chain recoloring was originally introduced by Kempe in 1879 in an attempt to prove the Four Color Theorem [24]. Although his proof was later found to be flawed, the technique has continued to play a central role in graph coloring theory [5, 27], statistical physics [28, 29], and the study of mixing times of Markov chains [36].
These results highlight a key aspect of reconfiguration problems: even when the definition of feasible solutions remains the same, the computational complexity of finding a reconfiguration sequence can vary greatly depending on the selected reconfiguration rule.
1.2 Our Contribution
In this paper, we introduce a new reconfiguration rule, called color swapping () for Coloring Reconfiguration. A new proper -coloring is obtained from a given one by swapping the colors of the endpoints of a single edge in , so that the resulting coloring remains proper. For example, Figure 1 shows a reconfiguration sequence between and under , hence it is a yes-instance. We refer to Coloring Reconfiguration and -Coloring Reconfiguration under as CRCS and -CRCS, respectively. The color swapping rule can be seen as a restricted variant of Kempe chain recoloring, where each Kempe chain is limited to exactly two vertices. Interestingly, this rule is also studied in statistical physics as (local) Kawasaki dynamics, which models dynamics in the fixed-magnetization Ising model [12, 23, 25].
The contribution of this paper is an analysis of the computational complexity of CRCS and -CRCS; for an overview of our results, we refer to Figure 2. First, we prove that CRCS is -complete even when the input graph is restricted to bipartite or split graphs. Furthermore, we show that there exists a positive integer such that for every fixed , -CRCS becomes -complete even when the input graph is restricted to chordal graphs, which is a superclass of split graphs.
We also establish a complexity dichotomy with respect to the number of colors: -CRCS is -complete for any fixed , whereas for , the problem can be solved in polynomial time. In particular, we show that -CRCS is -complete even when restricted to planar graphs with maximum degree and bounded bandwidth.
Complementing these hardness results, we also present several positive results. We first show that -CRCS can be solved in linear time on path graphs. To this end, we introduce an invariant for proper -colorings of paths, and design a linear-time algorithm that checks whether two input colorings have the identical invariants. While the algorithm is simple, its correctness requires a non-trivial argument.
Next, we show that CRCS can be solved in polynomial time on cographs. Our algorithm is based on a recursive procedure over the cotree of the input cograph, inspired by prior work [22] for Independent Set Reconfiguration on cographs. To adapt this approach to our problem, we introduce a new notion called extended -colorings as a generalization of -colorings.
Finally, we show that -CRCS on split graphs is polynomial-time solvable for any fixed . This contrasts with the -hardness of CRCS on split graphs when is unbounded.
Due to the space limitation, we omit the proofs of statements with the symbol marks, which can be found in the full version of this paper.
1.3 Related Work
As mentioned in Section 1.1, the complexity of -Coloring Reconfiguration has been extensively investigated with respect to various graph classes. Under both the single-vertex recoloring and Kempe chain recoloring rules, the problem is known to be -complete in general. Moreover, stronger hardness results and polynomial-time algorithms have been established for specific graph classes.
Under the single-vertex recoloring rule, the problem remains -complete even on bipartite planar graphs [8] and chordal graphs [17]. On the positive side, it is solvable in polynomial time for -degenerate graphs, -trees (for fixed ), trivially perfect graphs, and split graphs [17]. Under the Kempe chain recoloring rule, the problem is -complete even on planar graphs with maximum degree [6]; however, it is polynomial-time solvable on chordal graphs, bipartite graphs, and cographs [6]. Several other algorithmic and structural aspects of -Coloring Reconfiguration have also been studied, including finding a shortest reconfiguration sequence [9, 21] and bounding its length [1, 3, 10, 13].
The term color swapping is inspired by the Colored Token Swapping problem [7, 38], a reconfiguration problem involving token placements. In that problem, one is given a graph with an initial and a target coloring, which need not be proper, and the goal is to transform the initial coloring into the target one using the minimum number of swaps between tokens on adjacent vertices. Since feasibility is not restricted to proper colorings, this can be viewed as a variant of our reconfiguration problem in which the feasibility condition is relaxed. Yamanaka et al. [38] showed that Colored Token Swapping is -hard even when the number of colors is exactly three.
2 Preliminaries
For a positive integer , we write . For sets and , the symmetric difference of and is defined as . For a map and an element , the preimage of under is defined as .
Let be an undirected graph. We use and to denote the vertex set and edge set of , respectively. For a vertex of , and denote the open neighborhood and the closed neighborhood of in , respectively; that is, and . For a vertex set , we define and .
For a positive integer , a (proper) -coloring of a graph is a map that assigns different colors to adjacent vertices; in other words, for every edge . An independent set of a graph is a subset such that for all , holds. A clique of a graph is a subset such that for all with , holds.
2.1 Our Problems
For two proper colorings and of a graph , we say that and are adjacent under Color Swapping (denoted by ) if and only if the following two conditions hold:
-
1.
There exists exactly one edge such that and , and
-
2.
For all other vertices , we have .
Intuitively, can be obtained from by swapping the colors of two adjacent vertices.
A sequence of proper -colorings of with and is called a reconfiguration sequence between and if and are adjacent under for all . We say that and are reconfigurable if such a sequence exists. We now define the Coloring Reconfiguration under Color Swapping problem (CRCS for short). In CRCS, we are given a graph , a positive integer , and two proper -colorings and of . The goal is to determine whether there exists a reconfiguration sequence between and . For a fixed positive integer , the -CRCS problem is the special case of CRCS in which the two input colorings are -colorings.
An instance of CRCS is said to be valid if, for each color , the number of vertices assigned color is the same in and ; that is, . Note that if and are reconfigurable, then must be valid. This observation implies that if an instance of CRCS is not valid, we can immediately return “NO.” Therefore, throughout this paper, we assume that all instances of CRCS are valid.
It is easy to see that -CRCS for can be solved in polynomial time.
Observation 1 ().
-CRCS can be solved in polynomial time for .
3 PSPACE-completeness
We first observe that CRCS is solvable using polynomial space, i.e., CRCS belongs to the class . This follows from the equivalence , which is a consequence of Savitch’s theorem [32]. To see the membership of , consider a reconfiguration sequence for CRCS as a certificate. Our polynomial-space algorithm reads each -coloring in the sequence one by one and verifies that (i) each coloring is proper and (ii) each pair of consecutive colorings is adjacent under . Since each of these checks can be performed using polynomial space, this implies that CRCS can be solved in nondeterministic polynomial space. Therefore, by , we conclude that CRCS is in .
In this section, we present polynomial-time reductions from three different problems to establish the -completeness of our problem for several graph classes. Specifically, we reduce from the following problems: the Token Sliding problem in Section 3.1, the Coloring Reconfiguration problem in Section 3.2, and the Nondeterministic Constraint Logic problem in Section 3.3.
3.1 Reduction from Token Sliding
In this subsection, we present a polynomial-time reduction from the Token Sliding problem to CRCS. Token Sliding is also known as the Independent Set Reconfiguration under Token Sliding [18, 22].
Let be a graph, and let be a vertex subset of . Recall that is an independent set of if no two vertices in are adjacent; that is, for all . Two independent sets and of the same size are said to be adjacent under token sliding if and only if and the two vertices in are joined by an edge in .
In the Token Sliding problem, we are given a graph and two independent sets of the same size. The goal is to determine whether there exists a sequence of independent sets of such that and , and for every , and are adjacent.
Token Sliding is known to be -complete even when restricted to split graphs [2] or bipartite graphs [26]. A graph is split if its vertices can be partitioned into a clique and an independent set, and bipartite if its vertices can be partitioned into two independent sets.
We first show the following theorem for split graphs.
Theorem 2.
CRCS is -complete for split graphs.
Proof.
We have already observed that the problem is in . To show the -hardness, we give a polynomial-time reduction from Token Sliding on split graphs to CRCS.
Let be an instance of Token Sliding such that and is a split graph with vertex partition , where is a clique of and is an independent set of . Assume that . Note that Token Sliding remains -complete under this assumption since the problem is trivial when .
We construct an instance of CRCS as follows. Let be the graph obtained from by adding a new vertex that is adjacent to all vertices in . That is, let with and . Since is adjacent to all vertices in , the set is a clique of , and is an independent set of . Thus, is also a split graph.
Let . We now define proper -colorings and of . For each , set . Then, assign a distinct color from arbitrarily to each vertex in so that is a proper -coloring. Similarly, define by setting for each , and assigning a distinct color from arbitrarily to each vertex in so that is also a proper -coloring. Since and , such proper -colorings and exist.
This completes the construction of the instance . We claim that is a yes-instance of Token Sliding if and only if is a yes-instance of CRCS.
We first show the “only if” direction. Suppose that is a yes-instance of Token Sliding. Then, there exists a sequence of independent sets of , with and , and for each , and are adjacent under token sliding. For each , we construct a proper -coloring of from , following the same construction as for and : for each , set , and assign a distinct color from arbitrarily to each vertex in so that is a proper -coloring of .
We claim that for all , and are reconfigurable under . Let be the coloring obtained from by exchanging the colors assigned to the vertices and . Since each vertex in is assigned the color in , and all other vertices are assigned distinct colors from , the modified coloring remains a proper -coloring of . Moreover, since and are adjacent under token sliding, we have . Thus, and are adjacent under .
We now show that and are reconfigurable under . Recall that for all . Thus, and may differ only on the vertices in . Note that the restrictions of and to are both bijective.
By construction, is connected, since it contains a universal vertex adjacent to all others. It is known that for any connected -vertex graph and two bijective -colorings, there exists a reconfiguration sequence of length between them under [37]. Applying this result, we can reconfigure into using color swaps only within . Thus, and are reconfigurable under . This implies that we can construct a reconfiguration sequence between and under . Therefore, is a yes-instance of CRCS.
We now prove the “if” direction. Suppose that there exists a reconfiguration sequence between and under . Let be the reconfiguration sequence, where and . For each , define . Since the number of vertices colored remains constant throughout the sequence, it follows that for all . By construction, the vertex is adjacent to all other vertices in , and thus cannot be assigned color in any ; hence, . Moreover, since is a proper -coloring of , the set forms an independent set of , and consequently also an independent set of .
For each , since two consecutive proper -colorings and are adjacent under , we can observe that and are either identical or adjacent under token sliding. By deleting any consecutive duplicate independent sets from the , we obtain the desired sequence between and . Therefore, is a yes-instance of Token Sliding.
This completes the proof of Theorem 2.
The similar result holds for bipartite graphs.
Theorem 3.
CRCS is -complete for bipartite graphs.
Proof.
We have already observed that the problem is in . To show the -hardness, we give a polynomial-time reduction from Token Sliding on bipartite graphs to CRCS.
Let be an instance of Token Sliding, where is a bipartite graph with a bipartition , and both and are independent sets of . We construct an instance of CRCS as follows (see also Figure 3).
First, we construct by adding three new vertices to , and three new vertices to . We then make adjacent to all vertices in , and adjacent to all vertices in . Since and are independent sets of , the resulting graph is also bipartite.
We set , and define proper -colorings and of as follows. For the initial coloring , assign color to every vertex in . Then, assign a distinct color from arbitrarily to each vertex in so that is a proper -coloring of . Similarly, for the target coloring , assign color to every vertex in . Then, assign a distinct color from arbitrarily to each vertex in such that is also a proper -coloring of . Note that both and contain exactly vertices. Moreover, both and form independent sets of . Thus, it is always possible to assign the remaining colors so that both and are proper -colorings of .
This completes the construction of the instance . We then claim that is a yes-instance of Token Sliding if and only if is a yes-instance of CRCS.
We first show the “only if” direction. Suppose that is a yes-instance of Token Sliding. Then, there exists a sequence of independent sets of , with and , and for each , and are adjacent under token sliding. For each , we construct a proper -coloring of from , following the same construction as for and . for the coloring , assign color to every vertex in . Then, assign a distinct color from arbitrarily to each vertex in such that is also a proper -coloring.
We claim that and are reconfigurable under . Let be the coloring obtained from by exchanging the colors assigned to the vertices and . Since each vertex in is assigned the color , and all other vertices are assigned distinct colors from by , the modified coloring remains a proper -coloring of . Moreover, since and are adjacent under token sliding, we have . Hence, and are adjacent under .
We now prove that and are reconfigurable under . Recall that for all Thus, and may differ only on the vertices in . Note that the restrictions of and to are both bijective.
Recall that is adjacent to every vertex in and is adjacent to every vertex in , so the subgraph induced by is connected. As shown in the proof of Theorem 2 and using the result from [37], we see that and are reconfigurable under , and thus so are and . By repeating this process for all , we obtain a reconfiguration sequence from to under . Therefore, is a yes-instance of CRCS.
We now prove the “if” direction. Suppose that there exists a reconfiguration sequence between and under . Let be the reconfiguration sequence, where and .
Since and share the same neighbor and are both assigned color in , no color swap involving or is allowed throughout the sequence; that is, for all . By symmetry, we also have , which implies that and are never assigned color 1. For each , define and . Then, , and since is an independent set in , it follows that is also an independent set in .
Furthermore, since and are adjacent under for each , the sets and are either adjacent under token sliding or identical. By removing consecutive duplicates from the sequence , we obtain a reconfiguration sequence of independent sets from to under token sliding. Therefore, is a yes-instance of Token Sliding.
This completes the proof of Theorem 2.
3.2 Reduction from Coloring Reconfiguration
In this subsection, we give a polynomial-time reduction from the -Coloring Reconfiguration problem under single-vertex recoloring to -CRCS.
Let be a positive integer. In -Coloring Reconfiguration under single-vertex recoloring, we are given a graph and two -colorings and of . The goal is to determine whether there exists a sequence of -colorings with and such that for each , the colorings and differ at exactly one vertex; that is, . We simply call the problem -Coloring Reconfiguration. It is known that there exists a positive integer such that, for any fixed , -Coloring Reconfiguration is -complete on chordal graphs [17]. Recall that a graph is chordal if it contains no induced cycle of length at least .
We claim the following theorem.
Theorem 4.
There exists a positive integer such that, for any fixed , -CRCS is -complete on chordal graphs.
Proof.
We have already observed that the problem is in . To show the -hardness, we give a polynomial-time reduction from -Coloring Reconfiguration on chordal graphs to -CRCS.
Let be an instance of -Coloring Reconfiguration, where is a chordal graph. We construct an instance of -CRCS as follows (see also Figure 4). For each vertex , we add new vertices and make a clique in . Let . Note that the resulting graph is also chordal. We then define the -coloring as follows: for each , set , and for each vertex in , assign an arbitrary color distinct from so that is a proper -coloring of (which is always possible since ). Similarly, define for each , and for each vertex in , assign an arbitrary color distinct from so that is a proper -coloring of .
This completes the construction of the instance . We then claim that is a yes-instance of -Coloring Reconfiguration if and only if is a yes-instance of -CRCS.
We first prove the “only if” direction. Suppose that is a yes-instance of -Coloring Reconfiguration. Then there exists a reconfiguration sequence of proper -colorings of such that , , and for each , and differ at exactly one vertex. For each , we construct a proper -coloring of from , following the same construction as for and : for every , set , and for each , assign an arbitrary color distinct from so that is a proper -coloring of .
We claim that for all , and are reconfigurable under . Indeed, let be the unique vertex such that . By construction, we have , while for all . Let be the unique vertex such that . We construct a -coloring from by swapping the colors of and . Note that for all .
Recall that for each , the clique in contains exactly vertices, and in both colorings and , the vertices of receive pairwise distinct colors. Since vertices in are adjacent only to those in , we can freely perform color swaps within without affecting outside . Thus, we can reconfigure into by performing a sequence of color swaps only within cliques for . This implies that and are reconfigurable under . Applying this argument for each yields a reconfiguration sequence from to in under . Therefore, is a yes-instance of -CRCS.
We now prove the “if” direction. Suppose that there exists a reconfiguration sequence between and , where and . For each , define the coloring of by setting for every . Since is a proper -coloring of , the construction guarantees that is a proper -coloring of .
Observe that each () is a clique of size . Thus, any color swap occurs only on two vertices within some clique . It follows that for every , the colorings and are either identical or differ at exactly one vertex of . By removing any consecutive duplicate colorings, we obtain a desired sequence of proper -colorings of from to . Therefore, is a yes-instance of -Coloring Reconfiguration.
This completes the proof of Theorem 4.
3.3 Reduction from Nondeterministic Constraint Logic
In this subsection, we prove Theorem 5 by a polynomial-time reduction from the Nondeterministic Constraint Logic problem [19, 35].
Theorem 5.
For every fixed integer , -CRCS is -complete for planar graphs of maximum degree and bounded bandwidth.
We begin by formally defining the Nondeterministic Constraint Logic problem in Section 3.3.1. Next, we introduce an auxiliary gadget used in our reduction, which is described in Section 3.3.2. We then present the full reduction in Section 3.3.3, including the design of two types of gadgets: and gadgets, and or gadgets. Finally, we prove the correctness of the reduction in Section 3.3.4.
Note that our reduction is presented for ; however, it holds analogously for cases where .
3.3.1 Definition of Nondeterministic Constraint Logic
A Nondeterministic Constraint Logic (NCL) machine is an undirected graph in which each edge is assigned a weight from (see Figure 5 (a)). A configuration of an NCL machine is an orientation of its edges such that, at every vertex, the total weight of incoming edges is at least . Two configurations are said to be adjacent if they differ in the orientation of exactly one edge. In the Nondeterministic Constraint Logic problem, we are given an NCL machine and two of its configurations, and . The goal is to determine whether there exists a sequence of configurations starting from and ending at , such that each consecutive pair of configurations in the sequence differs in the orientation of exactly one edge; that is, they are adjacent.
An NCL machine is called an and/or constraint graph if it contains only two types of vertices: and vertices and or vertices (see again Figure 5 (a)). A vertex of degree in is an and vertex if its incident three edges have weights , , and ; see Figure 5 (b). Similarly, a vertex of degree in is defined as an or vertex if all its incident three edges have weight ; see Figure 5 (c). For the remainder of this paper, we will use the term NCL machine to refer specifically to an and/or constraint graph. It is known that the Nondeterministic Constraint Logic problem remains -complete when the input NCL machine (and/or constraint graph) is restricted to be planar, of maximum degree , and of bounded bandwidth [35]. Recall that, for a graph , the bandwidth of is the minimum integer such that has a bijection with .
3.3.2 Auxiliary Gadgets
Before presenting our full construction, we introduce auxiliary gadgets, called forbidden pendants, which prevent a vertex from being assigned a specific color.
Let be a set of colors. Consider a vertex adjacent to a vertex , where is part of a 4-cycle, as illustrated in Figure 6. We consider two possible colorings of the 4-cycle in clockwise order starting from : or . Note that in each of these colorings, is assigned color or , respectively.
Since is adjacent to , it must be assigned a color different from that of . In particular, can be assigned only colors from the sets or , respectively, depending on the color of . Furthermore, observe that no valid color swaps can occur within the cycle or between and in any reconfiguration sequence. This ensures that the color of remains fixed, and thus is prevented from ever taking the same color as .
If is assigned color , we refer to this gadget as a -forbidden pendant for . For simplicity, we use the diagram shown in Figure 6 (b) to represent such a gadget.
3.3.3 AND/OR Gadgets and Our Reduction
Let be an instance of Nondeterministic Constraint Logic. Our reduction constructs a graph by using two types of vertex gadgets, which simulate and and or vertices of , respectively. Each vertex of is replaced by the corresponding gadget according to its type.
For each edge in , the vertex gadgets for and each contain a special vertex, called a port vertex, which serves as an interface to the corresponding edge. These two port vertices, denoted by and , are connected by an edge referred to as a port edge (see Figure 7). Accordingly, the gadget corresponding to a vertex of with incident edges , , and includes three port vertices: , , and .
Let be an and vertex in , incident to one weight-2 edge and two weight-1 edges and . We construct the corresponding and gadget , which consists of two internal vertices: and , along with three port vertices: , , and . Each port vertex of is adjacent to a -forbidden pendant (see Figure 8 (a)); hence, it can only be colored with color or in any proper coloring. Consequently, any color swap involving a port vertex in must occur along the corresponding port edge.
Let be an or vertex in , incident to three weight-2 edges , , and . The corresponding or gadget consists of vertices, denoted by for and . For each , the vertex is a port vertex of , that is, . Moreover, every is adjacent to a -forbidden pendant, while each of and is adjacent to a -forbidden pendant (see Figure 8(b)).
Similar to the and gadget, each port vertex in is restricted to colors or due to its adjacency to a -forbidden pendant. Consequently, any color swap involving a port vertex in must occur along the corresponding port edge. Moreover, since both and for are adjacent to -forbidden pendants, they must be assigned distinct colors: one must be colored and the other . Thus, any color swap involving or can only occur on the edge .
Reduction
Let be an instance of Nondeterministic Constraint Logic. We construct a corresponding instance of -CRCS.
We begin by constructing a graph from the NCL instance as follows. For each and or or vertex in , we replace it with the corresponding gadget as defined in Section 3.3.3. Then, for each edge in , we add a port edge between the corresponding port vertices and in the gadgets for and , respectively; see Figure 7.
Let denote the resulting graph. Then, we observe the following.
Observation 6 ().
The constructed graph is planar, of maximum degree , and has bounded bandwidth.
We define two proper -colorings, and , of the constructed graph . We begin by assigning colors to all -forbidden pendants for according to the colorings described in Section 3.3.2.
Let be an edge of with an endpoint . For each corresponding port vertex , we set (resp. ) if the edge is directed toward in the configuration (resp. ); otherwise, we assign (resp. ).
For each and gadget corresponding to an and vertex of , we assign colors to the internal vertices and of , which are depicted in Figure 8, so that becomes a proper -coloring. That is, we set either and , or and . We define similarly to .
For each or gadget corresponding to an or vertex of , we assign colors to the internal vertices of depending on the coloring of its port vertices under (resp. ). Specifically, for a given coloring of the port vertices, the internal vertices are colored according to one of the configurations illustrated in Figure 9, so that (resp. ) becomes a proper -coloring. Since multiple valid internal colorings may exist for the same coloring of the port vertices of , we may choose any such coloring arbitrarily.
This completes our polynomial-time reduction.
3.3.4 Correctness
Before proceeding to our proof, we provide an overview of the main ideas behind our reduction and outline the argument for its correctness.
Our reduction establishes a correspondence between the orientations of edges in a given instance of Nondeterministic Constraint Logic and the colorings in the constructed graph . For each edge , we have associated two port vertices and in the gadgets for and , respectively. We interpret the edge as being oriented toward vertex if is assigned color , and as oriented toward vertex if is assigned color . Note that the coloring of each pair must be such that exactly one vertex is colored with and the other with .
We briefly describe the behavior of the and and or gadgets. The and gadget ensures that the port vertex can be colored with only if both and are colored with . Once this condition is satisfied, the vertex can be recolored with via a color swap with .
Next, we explain the behavior of the or gadgets. In an or vertex of , it suffices that at least one of the three incident edges is oriented inward. Accordingly, our gadget must only prohibit the configuration in which all three port vertices are simultaneously colored with . As shown in Figure 8(b), our construction enforces this constraint: if all three port vertices are colored with , then all intermediate vertices must also be colored with , which is impossible because the three vertices form a clique. Thus, at least one of the port vertices must be assigned color . See all proper colorings of the or gadget shown in Figure 9.
To establish the correctness of our reduction, we present the following lemma.
Lemma 7 ().
The instance of Nondeterministic Constraint Logic is a yes-instance if and only if the constructed instance of -CRCS is a yes-instance.
4 Polynomial-time Algorithms
In this section, we present polynomial-time algorithms for CRCS and -CRCS on paths, cographs, and split graphs.
4.1 Paths
We begin by presenting the following result for path graphs:
Theorem 8.
-CRCS can be solved in linear time for path graphs.
To prove Theorem 8, we design a linear-time algorithm that solves -CRCS on path graphs.
In our algorithm, we compute and compare the invariants of the two input -colorings. If the invariants are identical, the algorithm returns YES; otherwise, it returns NO. Although the implementation of our algorithm is relatively simple, we emphasize that the core idea behind the algorithm is conceptually nontrivial, as it captures the essential structure preserved under .
4.1.1 Invariant for Coloring Strings
Before introducing the invariant, we first define several terms used throughout this subsection.
Given a string , denotes the -th character of , and denotes the substring from the -th to the -th character (inclusive). If , we define , where denotes the empty string (a string of length ).
Let be a path on vertices. A string is called a coloring string if there exists a proper -coloring of such that for all . We sometimes refer to as the coloring string corresponding to . Note that a coloring can be encoded into its corresponding coloring string in time.
We say that two consecutive characters in are swappable if they can be exchanged to produce another coloring string . In this case, we say that and are adjacent. If no such pair of swappable characters exists in , then we say that is rigid. Note that each swap of two characters precisely corresponds to a single color swapping operation. Finally, two coloring strings and are said to be reconfigurable if there exists a sequence of coloring strings such that , , and each consecutive pair is adjacent for all .
We next observe a condition that determines whether two adjacent characters in a coloring string are swappable. Recall that a coloring string represents a proper -coloring of an -vertex path.
Observation 9.
Let be a coloring string. We can swap and in for if and only if the following conditions are satisfied:
-
If , then the three characters are pairwise distinct.
-
If , then holds.
-
If , then the three characters are pairwise distinct.
We now define the notion of contraction, which will be used to define our invariant for a coloring string. Let be a coloring string of length . We define the following three contraction operations:
- (C1.)
-
If and for some , then can be contracted to .
- (C2.)
-
If are pairwise distinct, then can be contracted to .
- (C3.)
-
If are pairwise distinct, then can be contracted to .
Note that in each of these cases, the contracted substring consists of three characters that are pairwise distinct.
Let denote the set of all coloring strings that can be obtained from by applying a single contraction operation. Each contraction reduces the length of the string by exactly , i.e., for every , we have . We now define the invariant of a coloring string recursively as follows:
The following lemma shows that is uniquely determined regardless of the order in which the contractions are applied.
Lemma 10 ().
For any coloring string , the invariant is well-defined.
A straightforward implementation of computing the invariant of a coloring string would take time, as each contraction step may require scanning the entire string, and up to such steps may be needed. However, the procedure can be implemented in linear time using a stack to efficiently simulate the recursive contractions.
Lemma 11 ().
For any coloring string of length , the invariant can be computed in time.
4.1.2 Correctness of Algorithm
In the following, we discuss the correctness of our algorithm presented in Section 4.1.1. We begin with the following lemma, which states that taking a single swap of characters preserves the invariant.
Lemma 12 ().
Let and be two adjacent coloring strings. Then, .
The next two lemmas are crucial for our converse direction: if two coloring strings have the identical invariant, then they are reconfigurable.
Lemma 13 ().
Let be a coloring string of length at least . If is not rigid, then there exists a coloring string such that are pairwise distinct, and and are reconfigurable.
Lemma 14 ().
Let and be coloring strings, and let and be two triples of pairwise distinct characters such that and are coloring strings. If and are reconfigurable, then and are also reconfigurable.
The following is the main theorem in this subsection.
Theorem 15.
Let be a valid instance of -CRCS such that is a path of -vertices, and let and be the coloring strings corresponding to and , respectively. Then, if and only if and are reconfigurable.
Proof.
The “if” direction follows directly from Lemma 12. Hence, we now prove the “only-if” direction. We show that and are reconfigurable if , by induction on the length of (and ).
For the base case where , we always have , and it is clear that and are reconfigurable.
For the induction step, assume that the claim holds for all coloring strings shorter than . Now consider . Since , either both and are rigid, or both are non-rigid. If both are rigid, then , so and are identical and thus trivially reconfigurable.
Suppose and are not rigid. By Lemma 13, there exist coloring strings and such that the first three characters of each string are pairwise distinct, and is reconfigurable to , while is reconfigurable to . Note that and can be contracted to and , respectively. Since , by the induction hypothesis, and are reconfigurable.
Applying Lemma 14, it follows that and are also reconfigurable. Consequently, by the transitivity of reconfigurability, and are reconfigurable.
4.2 Cographs
We begin by defining the class of cographs, also known as -free graphs [15]. For two graphs and , their disjoint union is defined as , and their join is defined as . A graph is a cograph if it can be constructed recursively according to the following rules:
-
1.
A graph consisting of a single vertex is a cograph.
-
2.
If and are cographs, then their disjoint union is also a cograph.
-
3.
If and are cographs, then their join is also a cograph.
This inductive definition yields a canonical tree representation called a cotree, where each leaf corresponds to a vertex of the graph, and each internal node is labeled as either a disjoint union node () or a join node (). Note that, by the definition of cographs, a cotree is a binary tree. For a cograph , let denote a cotree corresponding to , and for a node , let denote the subgraph of induced by the leaves of the subtree of rooted at . It is known that a cotree of a given cograph can be computed in linear time [34].
In this subsection, we provide a polynomial-time algorithm for CRCS on cographs.
Theorem 16.
CRCS can be solved in polynomial time for cographs.
4.2.1 Extended -Colorings
To describe our algorithm, we introduce the notion of extended colorings. Let be a positive integer. An extended -coloring of a graph is a map such that for every edge , either or . That is, we allow a special flexible color in addition to the usual color set , and adjacent vertices are permitted to share the color . Given an extended -coloring of , we define the set of swappable colors with respect to as . Namely, a color is swappable if it is used by exactly one vertex in under , or if and at least one vertex is assigned the color under .
Our polynomial-time algorithm solves a generalized version of CRCS, which we call the Extended -Coloring Reconfiguration (ECRCS) problem. In ECRCS, we are given a graph and two extended -colorings and of , and the goal is to determine whether there exists a sequence of extended -colorings that transforms into via color swaps. We use the terminology for ECRCS in the same way as for CRCS. Note that ECRCS generalizes CRCS in the following sense: for any instance of CRCS, it holds that is a yes-instance of CRCS if and only if it is a yes-instance of ECRCS. Furthermore, for any valid instance of ECRCS, the initial and target colorings and must have the same set of swappable colors, i.e., .
4.2.2 Polynomial-time Algorithm for Cographs
We now outline the strategy of our polynomial-time algorithm. Our approach is inspired by the polynomial-time algorithm for Token Sliding on cographs [22]. Indeed, an extended -coloring of a graph naturally corresponds to an independent set of , and thus our algorithm generalizes their result.
The algorithm proceeds recursively from the root to the leaves of the cotree of the input cograph , solving the ECRCS instance associated with each node of .
For a -coloring of , let and denote the restrictions of to and , respectively. Suppose that we are given an instance of ECRCS.
Leaf node.
Let be a cograph consisting of a single vertex . Observe that is a yes-instance of ECRCS if and only if .
Union node.
We consider the case where the root node of is a union node with children and . Since a union operation introduces no edges between and , swaps involving vertices in and those in occur independently. Therefore, is a yes-instance of ECRCS if and only if both and are yes-instances of ECRCS.
Join node.
We now consider the case where the root node of is a join node with children and . Note that since is a join node, all vertices in are adjacent to all vertices in . Consequently, for any -coloring of , no color can appear in both and .
We perform a case analysis based on whether any of the swappable color sets , , , or is empty. We begin with the following observation.
Observation 17 ().
Let be a yes-instance of ECRCS, where is a cograph and the root node of is a join node with children and . Then, the following statements hold:
-
1.
If at least one of or is empty, then no color swap between a vertex in and a vertex in occurs in any reconfiguration sequence from to .
-
2.
if and only if ; similarly, if and only if .
We first consider the case where at least one of or is empty.
Lemma 18 ().
Let be a valid instance of ECRCS, where is a cograph and the root node of is a join node with children and . Suppose that at least one of or is empty. Then, is a yes-instance of ECRCS if and only if both and are yes-instances of ECRCS.
We then consider the remaining case. Let be a valid instance of ECRCS, where is a cograph and the root node of is a join node with children and . For each , we define extended -colorings as follows:
By construction, both and are extended -colorings of .
Lemma 19 ().
Let be a valid instance of ECRCS, where is a cograph and the root node of is a join node with children and . Suppose that both and are non-empty. Then, is a yes-instance of ECRCS if and only if both and are yes-instances of ECRCS.
Algorithm.
The arguments for leaf, union, and join nodes naturally lead to a recursive algorithm for ECRCS on cographs. Since the set of swappable colors at each node of and the corresponding extended colorings can be constructed in polynomial time, the overall algorithm runs in polynomial time. This concludes the proof of Theorem 16.
4.3 Split Graphs
Recall that CRCS is -complete on split graphs, as shown in Theorem 2. In this subsection, we show a contrasting result: -CRCS is solvable in polynomial time on split graphs when the number of colors is a constant.
Theorem 20 ().
CRCS on split graphs admits a kernel with at most vertices, where is the number of colors of an input.
Theorem 20 immediately leads to the following Corollary 21.
Corollary 21.
-CRCS can be solved in polynomial time for split graphs.
5 Concluding Remarks
An intriguing direction is to determine the complexity of CRCS on graph classes that include paths. For example, does CRCS admit a polynomial-time algorithm on trees or on caterpillars? Another natural case is interval graphs, which are a subclass of chordal graphs where -CRCS has been shown to be -complete (Theorem 4). Since our algorithm for paths (Theorem 8) relies heavily on both the path structure and the restriction , it seems difficult to generalize our approach directly to broader classes. On the other hand, Token Sliding is known to be solvable in polynomial time on both trees [16] and interval graphs [4, 11]. Thus, as in the case of cographs (Theorem 16), it is conceivable that algorithms for CRCS could be derived from existing algorithms for Token Sliding.
References
- [1] Valentin Bartier, Nicolas Bousquet, Carl Feghali, Marc Heinrich, Benjamin Moore, and Théo Pierron. Recoloring planar graphs of girth at least five. SIAM J. Discret. Math., 37(1):332–350, 2023. doi:10.1137/21M1463598.
- [2] Rémy Belmonte, Eun Jung Kim, Michael Lampis, Valia Mitsou, Yota Otachi, and Florian Sikora. Token sliding on split graphs. Theory Comput. Syst., 65(4):662–686, 2021. doi:10.1007/S00224-020-09967-8.
- [3] Marthe Bonamy and Nicolas Bousquet. Recoloring bounded treewidth graphs. Electron. Notes Discret. Math., 44:257–262, 2013. doi:10.1016/J.ENDM.2013.10.040.
- [4] Marthe Bonamy and Nicolas Bousquet. Token sliding on chordal graphs. In Hans L. Bodlaender and Gerhard J. Woeginger, editors, Graph-Theoretic Concepts in Computer Science - 43rd International Workshop, WG 2017, Eindhoven, The Netherlands, June 21-23, 2017, Revised Selected Papers, volume 10520 of Lecture Notes in Computer Science, pages 127–139. Springer, 2017. doi:10.1007/978-3-319-68705-6_10.
- [5] Marthe Bonamy, Nicolas Bousquet, Carl Feghali, and Matthew Johnson. On a conjecture of mohar concerning kempe equivalence of regular graphs. J. Comb. Theory B, 135:179–199, 2019. doi:10.1016/J.JCTB.2018.08.002.
- [6] Marthe Bonamy, Marc Heinrich, Takehiro Ito, Yusuke Kobayashi, Haruka Mizuta, Moritz Mühlenthaler, Akira Suzuki, and Kunihiro Wasa. Diameter of colorings under kempe changes. Theor. Comput. Sci., 838:45–57, 2020. doi:10.1016/J.TCS.2020.05.033.
- [7] Édouard Bonnet, Tillmann Miltzow, and Pawel Rzazewski. Complexity of token swapping and its variants. Algorithmica, 80(9):2656–2682, 2018. doi:10.1007/S00453-017-0387-0.
- [8] Paul S. Bonsma and Luis Cereceda. Finding paths between graph colourings: PSPACE-completeness and superpolynomial distances. Theor. Comput. Sci., 410(50):5215–5226, 2009. doi:10.1016/J.TCS.2009.08.023.
- [9] Paul S. Bonsma, Amer E. Mouawad, Naomi Nishimura, and Venkatesh Raman. The complexity of bounded length graph recoloring and CSP reconfiguration. In Marek Cygan and Pinar Heggernes, editors, Parameterized and Exact Computation - 9th International Symposium, IPEC 2014, Wroclaw, Poland, September 10-12, 2014. Revised Selected Papers, volume 8894 of Lecture Notes in Computer Science, pages 110–121. Springer, 2014. doi:10.1007/978-3-319-13524-3_10.
- [10] Nicolas Bousquet and Marc Heinrich. A polynomial version of Cereceda’s conjecture. J. Comb. Theory B, 155:1–16, 2022. doi:10.1016/J.JCTB.2022.01.006.
- [11] Marcin Brianski, Stefan Felsner, Jedrzej Hodor, and Piotr Micek. Reconfiguring independent sets on interval graphs. In Filippo Bonchi and Simon J. Puglisi, editors, 46th International Symposium on Mathematical Foundations of Computer Science, MFCS 2021, August 23-27, 2021, Tallinn, Estonia, volume 202 of LIPIcs, pages 23:1–23:14. Schloss Dagstuhl – Leibniz-Zentrum für Informatik, 2021. doi:10.4230/LIPICS.MFCS.2021.23.
- [12] Charlie Carlson, Ewan Davies, Alexandra Kolla, and Will Perkins. Computational thresholds for the fixed-magnetization ising model. In Stefano Leonardi and Anupam Gupta, editors, STOC ’22: 54th Annual ACM SIGACT Symposium on Theory of Computing, Rome, Italy, June 20 - 24, 2022, pages 1459–1472. ACM, 2022. doi:10.1145/3519935.3520003.
- [13] Luis Cereceda, Jan van den Heuvel, and Matthew Johnson. Connectedness of the graph of vertex-colourings. Discret. Math., 308(5-6):913–919, 2008. doi:10.1016/J.DISC.2007.07.028.
- [14] Luis Cereceda, Jan van den Heuvel, and Matthew Johnson. Finding paths between 3-colorings. J. Graph Theory, 67(1):69–82, 2011. doi:10.1002/JGT.20514.
- [15] Derek G. Corneil, H. Lerchs, and L. Stewart Burlingham. Complement reducible graphs. Discret. Appl. Math., 3(3):163–174, 1981. doi:10.1016/0166-218X(81)90013-5.
- [16] Erik D. Demaine, Martin L. Demaine, Eli Fox-Epstein, Duc A. Hoang, Takehiro Ito, Hirotaka Ono, Yota Otachi, Ryuhei Uehara, and Takeshi Yamada. Linear-time algorithm for sliding tokens on trees. Theor. Comput. Sci., 600:132–142, 2015. doi:10.1016/J.TCS.2015.07.037.
- [17] Tatsuhiko Hatanaka, Takehiro Ito, and Xiao Zhou. The coloring reconfiguration problem on specific graph classes. IEICE Trans. Inf. Syst., 102-D(3):423–429, 2019. doi:10.1587/TRANSINF.2018FCP0005.
- [18] Robert A. Hearn and Erik D. Demaine. PSPACE-completeness of sliding-block puzzles and other problems through the nondeterministic constraint logic model of computation. Theor. Comput. Sci., 343(1-2):72–96, 2005. doi:10.1016/j.tcs.2005.05.008.
- [19] Robert A. Hearn and Erik D. Demaine. Games, puzzles and computation. A K Peters, 2009.
- [20] Jan van den Heuvel. The complexity of change. In Surveys in Combinatorics 2013, volume 409 of London Mathematical Society Lecture Note Series, pages 127–160. Cambridge University Press, 2013. doi:10.1017/CBO9781139506748.005.
- [21] Matthew Johnson, Dieter Kratsch, Stefan Kratsch, Viresh Patel, and Daniël Paulusma. Finding shortest paths between graph colourings. Algorithmica, 75(2):295–321, 2016. doi:10.1007/S00453-015-0009-7.
- [22] Marcin Kaminski, Paul Medvedev, and Martin Milanic. Complexity of independent set reconfigurability problems. Theor. Comput. Sci., 439:9–15, 2012. doi:10.1016/J.TCS.2012.03.004.
- [23] Kyozi Kawasaki. Diffusion constants near the critical point for time-dependent ising models. i. Phys. Rev., 145:224–230, May 1966. doi:10.1103/PhysRev.145.224.
- [24] A. B. Kempe. On the geographical problem of the four colours. American Journal of Mathematics, 2(3):193–200, 1879.
- [25] Aiya Kuchukova, Marcus Pappik, Will Perkins, and Corrine Yap. Fast and slow mixing of the kawasaki dynamics on bounded-degree graphs. In Amit Kumar and Noga Ron-Zewi, editors, Approximation, Randomization, and Combinatorial Optimization. Algorithms and Techniques, APPROX/RANDOM 2024, August 28-30, 2024, London School of Economics, London, UK, volume 317 of LIPIcs, pages 56:1–56:24. Schloss Dagstuhl – Leibniz-Zentrum für Informatik, 2024. doi:10.4230/LIPICS.APPROX/RANDOM.2024.56.
- [26] Daniel Lokshtanov and Amer E. Mouawad. The complexity of independent set reconfiguration on bipartite graphs. ACM Trans. Algorithms, 15(1):7:1–7:19, 2019. doi:10.1145/3280825.
- [27] Bojan Mohar. Kempe Equivalence of Colorings, pages 287–297. Birkhäuser Basel, Basel, 2007. doi:10.1007/978-3-7643-7400-6_22.
- [28] Bojan Mohar and Jesús Salas. A new kempe invariant and the (non)-ergodicity of the Wang–Swendsen–Kotecký algorithm. Journal of Physics A: Mathematical and Theoretical, 42(22):225204, May 2009. doi:10.1088/1751-8113/42/22/225204.
- [29] Bojan Mohar and Jesús Salas. On the non-ergodicity of the Swendsen–Wang–Kotecký algorithm on the kagomé lattice. Journal of Statistical Mechanics: Theory and Experiment, 2010(05):P05016, May 2010. doi:10.1088/1742-5468/2010/05/P05016.
- [30] C. M. Mynhardt and S. Nasserasr. Reconfiguration of colourings and dominating sets in graphs: a survey. CoRR, abs/2003.05956, 2020. doi:10.48550/arXiv.2003.05956.
- [31] Naomi Nishimura. Introduction to reconfiguration. Algorithms, 11(4):52, 2018. doi:10.3390/A11040052.
- [32] Walter J. Savitch. Relationships between nondeterministic and deterministic tape complexities. J. Comput. Syst. Sci., 4(2):177–192, 1970. doi:10.1016/S0022-0000(70)80006-X.
- [33] Alan D. Sokal. The multivariate tutte polynomial (alias potts model) for graphs and matroids. In Bridget S. Webb, editor, Surveys in Combinatorics, 2005: Invited lectures from the Twentieth British Combinatorial Conference, Durham, UK, July 2005, volume 327 of London Mathematical Society Lecture Note Series, pages 173–226. Cambridge University Press, 2005.
- [34] Marc Tedder, Derek G. Corneil, Michel Habib, and Christophe Paul. Simpler linear-time modular decomposition via recursive factorizing permutations. In Luca Aceto, Ivan Damgård, Leslie Ann Goldberg, Magnús M. Halldórsson, Anna Ingólfsdóttir, and Igor Walukiewicz, editors, Automata, Languages and Programming, 35th International Colloquium, ICALP 2008, Reykjavik, Iceland, July 7-11, 2008, Proceedings, Part I: Tack A: Algorithms, Automata, Complexity, and Games, volume 5125 of Lecture Notes in Computer Science, pages 634–645. Springer, 2008. doi:10.1007/978-3-540-70575-8_52.
- [35] Tom C. van der Zanden. Parameterized complexity of graph constraint logic. In Proceedings of IPEC 2015, pages 282–293, 2015. doi:10.4230/LIPICS.IPEC.2015.282.
- [36] Eric Vigoda. Improved bounds for sampling colorings. In 40th Annual Symposium on Foundations of Computer Science, FOCS ’99, 17-18 October, 1999, New York, NY, USA, pages 51–59. IEEE Computer Society, 1999. doi:10.1109/SFFCS.1999.814577.
- [37] Katsuhisa Yamanaka, Erik D. Demaine, Takehiro Ito, Jun Kawahara, Masashi Kiyomi, Yoshio Okamoto, Toshiki Saitoh, Akira Suzuki, Kei Uchizawa, and Takeaki Uno. Swapping labeled tokens on graphs. Theor. Comput. Sci., 586:81–94, 2015. doi:10.1016/J.TCS.2015.01.052.
- [38] Katsuhisa Yamanaka, Takashi Horiyama, J. Mark Keil, David G. Kirkpatrick, Yota Otachi, Toshiki Saitoh, Ryuhei Uehara, and Yushi Uno. Swapping colored tokens on graphs. Theor. Comput. Sci., 729:1–10, 2018. doi:10.1016/J.TCS.2018.03.016.
