Using Contracted Solution Graphs for Solving Reconfiguration Problems

We introduce in a general setting a dynamic programming method for solving reconfiguration problems. Our method is based on contracted solution graphs, which are obtained from solution graphs by performing an appropriate series of edge contractions that decrease the graph size without losing any critical information needed to solve the reconfiguration problem under consideration. Our general framework captures the approach behind known reconfiguration results of Bonsma (2012) and Hatanaka, Ito and Zhou (2014). As a third example, we apply the method to the following problem: given two $k$-colorings $\alpha$ and $\beta$ of a graph $G$, can $\alpha$ be modified into $\beta$ by recoloring one vertex of $G$ at a time, while maintaining a $k$-coloring throughout? This problem is known to be PSPACE-hard even for bipartite planar graphs and $k=4$. By applying our method in combination with a thorough exploitation of the graph structure we obtain a polynomial time algorithm for $(k-2)$-connected chordal graphs.


Introduction
Given a search problem we may want to find out if one solution for a particular instance is "close" to another solution of that instance to get more insight into the solution space of the problem. Studying the solution space from this perspective could, for instance, be potentially interesting for improving the performance of corresponding heuristics [16]. Searching the solution space by making small "feasible" moves also turned out to be useful when analyzing randomized algorithms for sampling and counting k-colorings of a graph or when analyzing cases of Glauber dynamics in statistical physics (see Section 5 of the survey [19]). In most general terms, the above situation can be modeled with solution graphs. We formalize this as follows: A solution graph concept S is obtained by defining a set of instances, solutions for these instances, and a (symmetric) adjacency relation between pairs of solutions. For every instance G of the problem, this gives a solution graph S(G), also called a reconfiguration graph, which has as node set all solutions of G, with edges as defined by the given adjacency relation. (If G has no solutions then S(G) is the empty graph.) The adjacency relation usually represents a smallest possible change (or reconfiguration move) between two solutions of the same instance. For example, the well-known k-Color Graph concept C k , related to the k-Colorability search problem, is defined as follows: instances are graphs G, and solutions are (proper) k-colorings of G. Two colorings are adjacent if and only if they differ in exactly one vertex. Note however that in general there may be more than one natural way to define the adjacency relation.

20:4
Using Contracted Solution Graphs for Solving Reconfiguration Problems a few additions, performs well in practice for various instances of reconfiguration problems, for which the theoretical complexity status is not yet resolved.
Our Application. In Section 3 we illustrate the method by giving dynamic programming rules for the C k -Reachability problem, which describe how to compute new (larger) contracted solution graphs from smaller ones. Recall that similar dynamic programming rules can be given for other reconfiguration problems, as done already in [5,18]. The given rules can be used when a tree decomposition of the graph is given. We emphasize that the rules solve the C k -Reachability problem correctly for every graph G (see e.g. [1,27] for information on finding tree decompositions). Nevertheless, the algorithm is only efficient when the contracted solution graphs stay small enough (that is, polynomially bounded). As indicated by the PSPACE-hardness of the problem, this is not always the case. In the same section, we illustrate the DP rules and show that the size of the contracted solution graphs can grow exponentially, even for 2-connected 4-colorable unit interval graphs.
In Section 4 we apply our method to show that, for all k ≥ 3, C k -Reachability is polynomially solvable for (k − 2)-connected chordal graphs. As unit interval graphs are chordal, the result from Section 3 implies that we need to exploit the structure of chordal graphs to prove this. This is not surprising: although C 3 -Reachability can be solved in polynomial time for all graphs [13], C k -Reachability is PSPACE-complete even for bipartite graphs, and if k ∈ {4, 5, 6} for planar graphs, and if k = 4 for planar bipartite graphs [8]. As the proof for the PSPACE-completeness result for bipartite graphs from [8] can be easily modified to hold for (k − 2)-connected bipartite graphs, our result for (k − 2)-connected chordal graphs cannot be extended to (k − 2)-connected perfect graphs. On the positive side, C k -Connectivity is polynomial-time solvable on chordal graphs. This is due to a more general result of Bonamy et al. [4], which implies that for a chordal graph G, C k (G) is connected if and only if G has no clique on more than k − 1 vertices. Hence, our result can be seen as an extension of this result if in addition (k − 2)-connectivity is imposed. Our result on C k -Reachability on (k − 2)-connected chordal graphs is also the first time that dynamic programming over tree decompositions is used to solve the general version of a PSPACE-complete reachability problem in polynomial time for a graph class strictly broader than trees. In Section 5 we discuss possible directions for future work.
Preliminaries. For a connected graph G, a vertex cut is a set S ⊆ V (G) such that G − S is disconnected. Vertices in different components of G − S are separated by S. For k ≥ 1, a (connected) graph G is k-connected if |V (G)| ≥ k + 1 and every vertex cut S has |S| ≥ k. The contraction of an edge uv of a graph G replaces u and v by a new vertex made adjacent to precisely those vertices that were adjacent to u or v in G (this does not create any multi-edges or loops). A graph is chordal if it has no induced cycle of length greater than 3.
Let G be a graph. A k-color assignment of G is a function α : A coloring of G is a k-coloring for some value of k. If α and β are colorings of G and a subgraph H of G, respectively, such that α| V (H) = β (that is, α and β coincide on V (H)) then α and β are said to be compatible. For an integer k, the k-color graph C k (G) has as nodes all (proper) k-colorings of G, such that two colorings are adjacent if and only if they differ on one vertex.
A recoloring sequence from a k-coloring α of G to a k-coloring β of G is a pseudowalk from α to β in C k (G). A labeled graph is a pair G, where G = (V, E) is a graph and : V → X is a vertex labeling (which may assign the same label to different vertices). A label preserving isomorphism between two labeled graphs G 1 , 1 and G 2 , 2 is an isomorphism . Informally, two labeled graphs G 1 , 1 and G 2 , 2 are the same if there exists a label preserving isomorphism between them.

The Method of Contracted Solution Graphs
In this section we define the concept of contracted solution graphs (CSGs) for reconfiguration problems in general. Consider a solution graph concept S, which for every instance G of S defines a solution graph that is denoted by S(G). A terminal projection for S is a function p that assigns a label to each tuple (G, T, γ) consisting of an instance G of S, a set T of terminals for G and a solution γ for G. Terminal projections are used to decide which nodes are "equivalent" and can be contracted. We remark that G and T can be anything, but in our example and in previous examples in the literature [5,18] G is always a graph, and T is a subset of its vertices. We also note that a terminal projection p can be seen as a node labeling for the solution graph S(G). So, for every instance G of S, every choice of terminals T may give a different node labeling for the solution graph S(G). When G and T are clear from the context, we may write p(γ) to denote the label of a node γ of S(G).
Example. Consider the k-color graph concept C k . Let G be a graph. We can define a terminal projection p as follows. Let T be a subset of V (G). The nodes of C k (G) are k-colorings and we give each node as label its restriction to T , that is, for every k-coloring γ of G, we set Let p be a terminal projection for a solution graph concept S. For an instance G of S and a terminal set T , a label component C of S(G) is a maximal set of nodes γ that all have the same label p(γ) and that induce a connected subgraph of S(G). It is easy to see that every solution γ of G is part of exactly one label component, or in other words: the label components partition the node set of S(G). The contracted solution graph (CSG) S c (G, T ) is a labeled graph that has a node set that corresponds bijectively to the set of label components of G. For a node x of S c (G, T ), we denote by S x the corresponding label component. Two distinct nodes x 1 and x 2 of S c (G, T ) are adjacent if and only if there exist solutions γ 1 ∈ S x1 and γ 2 ∈ S x2 such that γ 1 and γ 2 are adjacent in S(G). We define a label function * for nodes of S c (G, T ) to denote the corresponding label in S(G). More precisely: for a node x of S c (G, T ), the label * (x) is chosen such that * (x) = p(γ) for all γ ∈ S x . Note that the contracted solution graph S c (G, T ) can also be obtained from S(G) by contracting all label components into single nodes and choosing node labels appropriately.
Example. Figure 1(c) shows one component of C 4 (G) for the (4-colorable) graph G from Figure 1(a). This is the component that contains all colorings of G whose vertices a, b, c, d are colored with colors 4, 3, 2, 1, respectively (note that it is not possible to recolor any of these four vertices if one may recolor only one vertex at a time). So in Figure 1

20:6
Using Contracted Solution Graphs for Solving Reconfiguration Problems -colorings in the node labels are given as sequences of colors, for the (ordered version of) T as indicated below each CSG. Example (c) can also be seen as the component of C4(G) where vertices a, b, c, d receive colors 4, 3, 2, 1.
We stress that the CSG S c (G, T ) is a labeled graph that includes the label function * defined above. However, to keep its size reasonable, the CSG itself does not include the solution sets S x for each node that were used to define it. For proving the correctness of dynamic programming rules for CSGs the following alternative characterization of CSGs (proof omitted) is useful; note that the sets S x correspond exactly to the label components. A mapping S that assigns solution sets (or label components) S x to each node x of S c (G, T ) that satisfies the properties given in Lemma 1 is called a certificate for S c (G, T ). Given such a certificate S and a solution γ for G, the γ-node of S c (G, T ) with respect to S is the node x with γ ∈ S x . For readability, we will not always explicitly mention this certificate when talking about γ-nodes in S c (G, T ) (except in Lemma 2 below), but the reader should keep the following convention in mind: when γ-nodes are identified in S c (G, T ) for multiple solutions γ, these are all chosen with respect to the same certificate.
Example. In Figures 1(c)-(f), the α-node for the coloring α shown in Figure 1(b) is marked.
In particular consider C c 4 (G, {g}) in Figure 1(e). Since the certificate for C c 4 (G, {g}) is not actually indicated in the figure, the other leaf with label 2 can also be chosen as the α-node (considering the nontrivial label-preserving automorphisms of the graph). Similarly, if we choose a coloring β that coincides with α except on nodes e and f , where we choose β(e) = 3 and β(f ) = 4, then the same two leaves (the ones with label 2) of C c 4 (G, {g}) can be chosen as the β-node. Nevertheless, if both an α-node and β-node are marked, then this will only be correct according to the above convention when they are distinct!
The main purpose of our definitions is the following key observation (we omit its proof). Lemma 2 implies that for a solution graph concept S and any terminal projection p and terminal set T , we can decide S-Connectivity if we know S c (G, T ) (the answer is YES if and only if S c (G, T ) is connected) and the S-Reachability problem if we know S c (G, T ) and the α-node and the β-node (the answer is YES if and only if these two nodes are in the same component). However, for obtaining an efficient algorithm using this strategy, we must choose the terminal projection p smartly: we need to throw away enough irrelevant information to ensure that S c (G, T ) will be significantly smaller than S(G), yet maintain enough information to ensure the efficient computation of S c (G, T ), without first constructing S(G). Our strategy for doing this is to use dynamic programming to compute S c (H, T ) for ever larger subgraphs H of G, while ensuring that all of the CSGs stay small throughout the process. The remainder of this paper shows a successful example of this strategy.

Dynamic Programming Rules for Recoloring
The following terminology is based on widely used techniques for dynamic programming over tree decompositions; see Section 4 and [2, 27, 33] for background information. A terminal graph (G, T ) is a graph G together with a vertex set T ⊆ V (G), whose vertices are called the terminals. If T = V (G), then (G, T ) is called a leaf. If v ∈ T , then we say that the new terminal graph (G, T \ {v}) is obtained from (G, T ) by forgetting v (or using a forget operation). If T = V (G), v ∈ T and N (v) ⊆ T then we say that (G, T ) can be obtained from (G − v, T \ {v}) by introducing v (or using an introduce operation). Note that for a terminal graph (G , T ) with T = ∅, different graphs can be obtained from (G , T ) by introducing a vertex v, whereas forgetting a terminal always yields a unique result. As we will see, the condition that each neighbor of the new vertex v must be in T is necessary. We say that (G, T ) is the join of (G 1 , T ) and (G 2 , T ) (or can be constructed using a join operation) if G 1 and G 2 are induced subgraphs of G, = T , and for every uv ∈ E(G), it holds that uv ∈ E(G 1 ) or uv ∈ E(G 2 ). We will now focus on CSGs for the k-color graph concept C k , using the terminal projection p(G, T, γ) = γ| T . We will show how to compute the CSG C c k (G, T ) when (G, T ) is obtained using a forget, introduce or join operation from a (pair of) graph(s) for which we know the CSG(s). We recall that a variant of these CSGs have been considered before by Hatanaka, Ito and Zhou [18], namely for the case that |T | = 1 in the context of list colorings of caterpillars. Similar dynamic programming rules were given in [18]: for the case that |T | = 1, they presented a combined introduce and forget rule, and a restricted type of join rule.

20:8 Using Contracted Solution Graphs for Solving Reconfiguration Problems
We start by stating a trivial rule for computing C c k (G, T ) for leaves, which follows from the facts that C k (G) has k-colorings of G as nodes and that the label (x) of a node x in We now give the rules for the forget, introduce and join operations. Figure 2 illustrates the first two rules. We show how Lemma 1 can be applied to prove Lemma 4; the other proofs are similar. Proof sketch: Let S denote the certificate for H, , so for every node x of H, S x denotes the set of k-colorings of G (or solutions), such that these sets satisfy the properties stated in Lemma 1. In addition, for every coloring γ for which a γ-node x has been marked in H, we may assume that γ ∈ S x . We will prove the statement using Lemma 1 again, by giving a certificate S for H , , and proving that the five properties hold for these. The graph H is obtained by iteratively contracting edges of H, so every node y of H corresponds to a connected set of nodes of H, which we will denote by M y . So {M y | y ∈ V (H )} is a partition of V (H). For every node y ∈ V (H ), we define S y = ∪ x∈My S x . For every k-coloring γ of G such that the γ-node x ∈ V (H) is marked, we define the γ-node of H to be the node y with x ∈ M y . Clearly, γ ∈ S y then holds, so this is correct. One can now verify that the solution sets S x satisfy the five properties stated in Lemma 1. Moreover, for every k-coloring γ of G, if x is the γ| V (G1) -node in H 1 and y is the γ| V (G2) -node in H 2 , then (x, y) is the γ-node in H.

Remark 1.
The DP rules in this section can be generalized further to capture the rules of [18] for the list coloring generalization C L of C k . In this generalization, an instance G, L consists of a graph G together with color lists L(v) ⊆ {1, . . . , k} for each v ∈ V (G). Solutions are now list colorings, which are colorings α of G such that α(v) ∈ L(v) for each v ∈ V (G). Adjacency is defined as before. So the list coloring solution graph C L (G, L) is an induced subgraph of C k (G). Hence, it is straightforward to generalize our DP rules to C L , namely by simply omitting all nodes that correspond to invalid vertex colors.
We now show that components of C c k (G) can grow exponentially even if G is chordal and k = 4. First, when considering 4-colorable chordal graphs with cut vertices, it is easy to obtain CSGs that have exponentially large components: take p copies of the graph shown in Figure 1(a), and identify the g-vertices of all of these graphs. Call the resulting graph G * p . We can show that, for every integer p ≥ 1, C c 4 (G * p , {g}) has a component with 1 + 3 · 2 p nodes. We can construct CSGs with exponentially large components for (k − 2)-connected k-  Figure 2. Note that each G I p is unit interval. To state our claim more precisely, for every p = 4q + 4 with q ∈ N, we can show that the CSG C c 4 (G I p , {v p−2 , v p−1 }) has 4! components on at least 2 q nodes.
Both examples show that we need to do more than only computing CSGs to solve the problem for (k − 2)-connected chordal graphs. Next, we will characterize the CSGs and show that it suffices to compute only a part of them.

Recoloring Chordal Graphs
We will show that CSGs can be used to efficiently decide the C k -Reachability problem for (k − 2)-connected chordal graphs. To prove this we use the fact that for a chordal graph G and any clique T of G, the terminal graph (G, T ) can recursively be constructed from simple cliques using a polynomial number of clique-based introduce, forget and join operations. We remark that some statements given here are similar to (and can alternatively be deduced from) well-known facts about tree decompositions [14] and nice tree decompositions [27]. However, for readability, and since we need to prove a new bound on the size of any tree decomposition, we give a self-contained presentation.
A nice tree decomposition of a terminal graph (G, T ) (where G is not necessarily chordal and T may not be a clique) is a tuple (T , X, r), where T is a tree with root r and X is an assignment of bags X u ⊆ V (G) for each u ∈ V (T ) that can be defined recursively as follows: 1. If T = V (G), then the tree T consists of one (root) node r with bag X r = T .

2.
If v ∈ V (G) \ T and (T , X, r ) is a nice tree decomposition of (G, T ∪ {v}), then a nice tree decomposition for (G, T ) can be obtained by adding a new root r with X r = T , and adding the edge rr .

If (G, T ) can be obtained from (G − v, T \ {v}) using an introduce operation and (T , X, r )
is a nice tree decomposition of (G − v, T \ {v}), then a nice tree decomposition for (G, T ) can be obtained by adding a new root r with X r = T , and adding the edge rr . 4. If (G, T ) can be obtained from (G 1 , T ) and (G 2 , T ) using a join operation, and (T 1 , X, r 1 ) and (T 2 , X, r 2 ) are nice tree decompositions of (G 1 , T ) and (G 2 , T ), then a nice tree decomposition for (G, T ) can be obtained by adding a new root r with X r = T and adding edges rr 1 and rr 2 . We call a node u ∈ V (T ) a leaf, forget node, introduce node or join node if u is added as the root in case (1), (2), (3) or (4), respectively. The width of (T , X, r) is max u∈V (T ) |X u | − 1.
The bound from Lemma 7 holds for any nice tree decomposition, in contrast to the (stronger) bound of [27] which states that for any graph G, a nice tree decomposition of G of width at most 4n can be constructed (for an appropriate choice of the terminal set T ). A nice tree decomposition (T , X, r) of (G, T ) is chordal if for every node u ∈ V (T ), X u is a clique of G. If (T , X, r) is a chordal nice tree decomposition of a k-colorable graph G, then the width of (T , X, r) is at most k − 1. Hence, Lemma 7 shows that any chordal nice tree decomposition has at most (k + 3)n nodes. This bound is asymptotically sharp.

Theorem 8. (proof omitted)
There are k-colorable chordal graphs G for which any chordal nice tree decomposition has at least Ω(kn) nodes.
In order to show how to find a chordal nice tree decomposition in polynomial time we need the following lemma (proof omitted), which tells us how to select the proper type of root node when constructing such a tree decomposition. A terminal graph (G 1 , T 1 ) is called smaller than another terminal graph ( By combining Lemmas 7 and 9 we obtain the following result.

Corollary 10.
Let G be a chordal k-colorable graph on n vertices, and let T be a clique of G. In polynomial time, we can find a chordal nice tree decomposition of (G, T ) on at most (k + 3)n nodes.
Proof. Lemma 9 shows how we can choose the proper type of root node. We can build the chordal nice tree decomposition by adding this node to the tree decomposition(s) of (a) smaller graph(s). The entire chordal nice tree decomposition is constructed by continuing this process recursively. Lemma 7 shows that the resulting chordal nice tree decomposition has at most (w + 4)n nodes, where w + 1 is the maximum bag size. Since every bag is a clique of G and the graph is k-colorable, we have w + 1 ≤ k, so there are at most (k + 3)n nodes. Since we have a polynomial number of nodes, and for every node we spend polynomial time (Lemma 9), the entire process terminates in polynomial time.
The precise complexity bound in Corollary 10 depends on implementation details beyond the scope of this paper.
Using an inductive proof based on Lemma 9, we will now characterize the shape of CSGs for (k − 2)-connected k-colorable chordal graphs. For integers m, k with 1 ≤ m ≤ k, a labeled graph H, is an (m, k)-color-complete graph if there exists a set T with |T | = m such that: for all vertices v ∈ V (H), (v) is a k-coloring of a complete graph on vertex set T , every such k-coloring of T appears at exactly one vertex of H, and two vertices of H are adjacent if and only if their labels differ on exactly one element of T . From this definition it follows that for every pair of integers m and k, there is a unique (m, k)-color complete graph, up to the choice of T . An (m, k)-color-complete graph has k!/(k − m)! vertices (this is the number of ways to k-color a complete graph on m vertices), and every vertex has degree m(k − m). In particular, if m = k then the graph consists of k! isolated vertices (which is a forest). A labeled graph H, is said to satisfy the injective neighborhood property (INP) if for every vertex u ∈ V (H) and every pair of distinct neighbors v, w ∈ N (u), it holds that (v) = (w). Note that (m, k)-color-complete graphs trivially satisfy the INP. We prove Theorem 12 by first showing that for our graphs the following invariant (Theorem 11) is maintained by introduce, forget and join operations. This invariant can be proven by induction based on Lemma 9, using the rules from Section 3.

20:12
Using Contracted Solution Graphs for Solving Reconfiguration Problems Remark 2. Figure 1 shows that if we relax the connectivity requirement to (k − 3)connectedness, the above property does not necessarily hold anymore: the examples in Figure 1(c) and (d) are not forests, and the example in Figure 1(e) does not satisfy the INP.
The characterization of C c k (G, T ) in Theorem 11 does not yet guarantee that simply keeping track of the (relevant component of the) CSG yields a polynomial-time algorithm, as shown by the second example in Section 3. However, we will now show that it suffices to only keep track of the following essential information, which remains polynomially bounded.
Let G = (V, E) be a graph with T ⊆ V , and let α and β be k-colorings of a supergraph of G. (G should be viewed as a subgraph that occurs during the dynamic programming, while α and β are the colorings of the full graph.) Let α = α| V and β = β| V . If C c k (G, T ) is a forest with the α -node x and β -node y in the same component, then we define the α-β-path to be the unique path in C c k (G, T ) with end vertices x and y (together with its vertex labels). Given the two colorings α and β, the essential information for C c k (G, T ) consists of the following: whether the α and β nodes appear in the same component, whether C c k (G, T ) is a forest, and in case the answers to both questions are yes: the α-β-path in C c k (G, T ).

Theorem 12.
For a k-colorable (k − 2)-connected chordal graph G with two k-colorings α and β, we can decide in polynomial time whether C k (G) contains an α-β path.
Proof sketch: Corollary 10 shows that for every chordal k-colorable graph G on n vertices, we can find in polynomial time a chordal nice tree decomposition on at most (k + 3)n nodes. So every node of this tree decomposition corresponds to a (k − 2)-connected chordal subgraph H of G with terminal set T , such that either H is a clique with T = V (H) (leaf nodes), or (H, T ) can be obtained from the graph(s) corresponding to its child node(s) using a forget, introduce or join operation. For every one of those terminal subgraphs, we compute the essential information, bottom up. If at any point, the α and β nodes are separated, the answer is NO. Forget, introduce and join operations maintain a forest. The lemmas from Section 3 show how the α-β-path can be computed. We return YES if in the root node, a color-complete graph or an α-β-path is obtained (Lemma 2). The total number of operations (tree decomposition nodes) is O(kn). For every operation, the essential information can be computed in polynomial time (in the input size, which includes the path length). One can show that the maximum length of any α-β path that occurs during the computation is O(kn). Hence, the algorithm terminates in polynomial time.
We stress that (m, k)-color complete graphs, which have k!/(k − m)! nodes, are not computed explicitly in our algorithm. So indeed, in order to obtain a polynomial-time algorithm, we do not need to assume that k is a constant.

Discussion
An obvious question is whether our polynomial-time algorithm for can be extended to all chordal graphs, or whether C k -Reachability is PSPACE-hard for chordal graphs. As C 3 -Reachability is polynomial-time solvable in general [13], the first open case is the complexity of C 4 -Reachability for chordal graphs (with at least one cut vertex). We refer to Remark 2 for a discussion on why our current proof technique does not work for this case. We also note that the complexity of C 4 -Reachability is open for proper interval graphs (initial experimental results for these graphs seem to suggest that even this problem is not straightforward to solve). The two most important future research goals are the following.
1. Explore for which other solution graph concepts S the DP method can be used to obtain polynomial-time algorithms for the S-Reachability problem. The DP method has now been used to obtain polynomial-time algorithms for several reconfiguration problems, but its true strength is not always revealed when using the viewpoint of worst-case algorithm analysis. For instance, when considering randomly generated k-colorable chordal or interval graphs, we observed that the method performs well on most instances, despite the fact that specialized examples can be constructed that exhibit exponential growth. As we noticed when considering other reconfiguration problems, this behavior seems to occur in general.
Because of this, we will write a subsequent paper which will include computational studies, where we apply extensions of this method to various other reconfiguration problems such as well-studied variants of independent set reconfiguration problems (see e.g. [9,26]).

Explore which known reconfiguration problems can be solved efficiently using CSGs.
The method of using CSGs can easily be applied to solve the S-Connectivity problem. Hence, this well-studied problem is a suitable candidate problem for the second research goal.