Mar 2, 2000 - The emergence of constraint logic programming (CLP) as de ned by J. Ja ar ... programming could be generalized to arbitrary mathematical structures ... The set of solutions of a composite model is the intersection of the ... ability of

Abstract Graph constraint logic is a framework introduced by Hearn and Demaine [8], which provides several problems that are often a convenient starting point for reductions. We study the parameterized complexity of Constraint Graph Satisfiability and both bounded and unbounded versions of Nondeterministic Constraint Logic (NCL) with respect to solution length, treewidth and maximum degree of the underlying constraint graph as parameters. As a main result we show that restricted NCL remains PSPACE-complete on graphs of bounded bandwidth, strengthening Hearn and Demaine’s framework. This allows us to improve upon existing results obtained by reduction from NCL. We show that reconfiguration versions of several classical graph problems (including independent set, feedback vertex set and dominating set) are PSPACE-complete on planar graphs of bounded bandwidth and that Rush Hour, generalized to k × n boards, is PSPACE-complete even when k is at most a constant. 1998 ACM Subject Classification F.2.2 Nonnumerical Algorithms and Problems Keywords and phrases Nondeterministic Constraint Logic · Reconfiguration Problems · Parameterized Complexity · Treewidth · Bandwidth

1

Introduction

Nondeterministic Constraint Logic (NCL) was introduced by Hearn and Demaine in [8] and extended in [10] to a more general graph constraint logic framework. The framework provides a number of problems complete for various complexity classes, that aim to provide a convenient starting point for reductions proving the hardness of games and puzzles. We study the Constraint Graph Satisfiability problem and Nondeterministic Constraint Logic in a parameterized setting, considering (combinations of) solution length, treewidth and maximum degree of the underlying constraint graph as parameters. As part of the constraint logic framework [8], Hearn and Demaine provide a restricted variant of Nondeterministic Constraint Logic (restricted NCL), in which the constraint graph is planar, 3-regular, uses only weights in {1, 2} and the graph is constructed from only two specific vertex types (AND and OR). Restricted NCL is PSPACE-complete, and is (due to the restrictions) a particularly suitable starting point for reductions. Hearn and Demaine’s reduction creates graphs of unbounded treewidth. We strengthen their result, by providing a new reduction showing that restricted NCL remains PSPACE-complete, even when restricted to graphs of bandwidth at most a given constant (which is a subclass of graphs of treewidth at most a given constant). We show hardness by reduction from H-Word Reconfiguration [16]. The puzzle game Rush Hour, when generalized to n × n boards, is PSPACE-complete [6]. Hearn and Demaine provide a reduction from NCL to Rush Hour [9]. As a consequence of this reduction and our improved hardness result for NCL, we show that Rush Hour is PSPACE-complete even when played on k × n boards, where k is a constant. This is in

T. C. van der Zanden

2

contrast to the result of Ravikumar [15] that Peg Solitaire, a game NP-complete on n × n boards, is linear time solvable on k × n boards for any fixed k. NCL is also has applications in showing the hardness of reconfiguration problems [13, 7, 3, 12]. For some reconfiguration problems, their hardness on planar graphs of low maximum degree is known by reduction from NCL [7, 12] while their hardness on bounded bandwidth graphs is known by reduction from H-Word Reconfiguration [16, 7, 14]. Our reduction, which combines techniques from Hearn and Demaine’s constraint logic [10] and the reductions from H-Word Reconfiguration in [16, 14] unifies these results: we show that a number of reconfiguration problems (including Independent Set, Vertex Cover and Dominating Set) are PSPACE-complete on low-degree, planar graphs of bounded bandwidth. Previously, hardness was known only on graphs that either are planar and have low degree or have bounded bandwidth - we show that the problems remain hard even when both of these conditions hold simultaneously. Note that while a graph of bounded bandwidth also has bounded degree, the graphs created in these reductions have quite large bandwidth. The degree bounds we obtain are much tighter than what would be obtained from the bandwidth bound alone. Our results concerning the hardness of constraint logic problems are summarized in Table 1. This table shows the parameterized complexity of Constraint Graph Satisfiability (CGS), unbounded configuration-to-edge (C2E) and configuration-to-configuration (C2C) variants of Nondeterministic Constraint Logic and their respective bounded counterparts (bC2E and bC2C) with respect to solution length (l), maximum degree (∆) and treewidth (tw). If a traditional complexity class is listed this means that the problem is hard for this class even when restricted to instances where the parameter is at most a constant.

Parameters

Table 1 Parameterized complexity of graph constraint logic problems.

2 2.1

l l+∆ tw tw + ∆

CGS NP-C weakly NP-C FPT

C2E PSPACE-C W[1]-hard FPT PSPACE-C PSPACE-C

Problem C2C PSPACE-C W[1]-hard FPT PSPACE-C PSPACE-C

bC2E NP-C W [1]-hard FPT weakly NP-H FPT

bC2C NP-C FPT FPT weakly NP-H FPT

Preliminaries Constraint Logic

I Definition 1 (Constraint Graph). A constraint graph is a graph with edge weights and vertex weights. A legal configuration for a constraint graph is an assignment of an orientation to each edge such that for each vertex, the total weight of the edges pointing into that vertex is at least that vertex’ weight (its minimum inflow).

T. C. van der Zanden

3

A fundamental decision problem regarding constraint graphs is that of their satisfiability: Constraint Graph Satisfiablility Instance: A constraint graph G. Question: Does G have a legal configuration? Constraint Graph Satisfiability (CGS) is NP-complete [10]. An important problem regarding constraint graph configurations is whether they can be reconfigured into each other: Nondeterministic Constraint Logic (C2C) Instance: A constraint graph G and two legal configurations C1 , C2 for G. Question: Is there a sequence of legal configurations from C1 to C2 , where every configuration is obtained from the previous configuration by changing the orientation of one edge? This problem is called the configuration-to-configuration (C2C) variant of Nondeterministic Constraint Logic . It is PSPACE-complete [10]. The configuration-to-edge variant (C2E) is also PSPACE-complete [10]: Nondeterministic Constraint Logic (C2E) Instance: A constraint graph G, a target edge e from G and an initial legal configuration C1 for G. Question: Is there a sequence of legal configurations, starting with C1 , where every configuration is obtained from the previous by changing the orientation of one edge, so that eventually e is reversed? For the C2C and C2E problems, bC2C and bC2E denote their bounded variants which ask whether there exists a reconfiguration sequence in which each edge is reversed at most once. These problems are NP-complete [10]. Hearn and Demaine [10] consider a restricted subset of constraint graphs, which are planar and constructed using only two specific types of vertices: AND and OR vertices (Figure 1). The OR vertex has minimum inflow 2 and three incident weight 2 edges. Its inflow constraint is thus satisfied if and only if at least one of its incident edges is directed inwards (resembling an OR logic gate). The AND vertex has minimum inflow 2, two incident weight 1 edges and one incident weight 2 edge. Its constraint is thus satisfied if and only if both weight 1 edges are directed inwards or the weight 2 edge is directed inwards (resembling an AND logic gate). Both C2C and C2E NCL remain PSPACE-complete under these restrictions.

2 2

2 2

(a) OR vertex

2

1

2

1

(b) AND vertex

Figure 1 The two vertex types from which a restricted constraint graph is constructed: (a) OR vertex and (b) AND vertex. Following the convention set in [8], as a mnemonic weight 2 edges are drawn blue (dark grey) and thick, while weight 1 edges are drawn red (light grey) and thinner.

T. C. van der Zanden

2.2

4

Constraint Logic Gadgets

Some constructions in this paper use existing gadgets (such as crossover) for NCL reductions due to Hearn and Demaine [10]. For the purpose of being self-contained, we reproduce these gadgets here and state (without proof) their functionality. Edge Terminators. The constrained blue-edge (Figure 2a) terminator allows us to have a loose blue edge that is forced to point outwards, effectively removing the edge from the graph while still meeting the requirement that the graph is built from only AND and OR vertices. The free red-edge terminator (Figure 2b) allows us to have a loose red edge whose orientation can be freely chosen, effectively decreasing the minimum inflow of the vertex to which it is incident by one. Red-blue Conversion. It is useful to be able to convert a blue edge to a red edge, i.e. we require a gadget which has a blue edge that can (be reconfigured to) point outwards if and only if its red edge is pointing inwards and vice-versa. Hearn and Demaine [10] provide a construction that allows red-blue conversion in pairs, but also note a simpler construction is possible: an AND vertex, with one of its red edges attached to a free red-edge terminator (Figure 2b) can serve as a red-blue conversion gadget. Crossover Gadget. The crossover gadget (Figure 3a) has 4 incident blue edges A, B, C and D, with the property that A can (be reconfigured to) point outward only if B is pointing inwards and vice-versa, with the same property also holding for C and D. The crossover gadget is constructed using degree-4 vertices (of minimum inflow 2) that are incident to four weight-1 edges. These can be replaced with the half-crossover gadget (Figure 3b) to obtain a construction that only uses AND and OR vertices. Note that this replacement requires using red-blue conversion gadgets. Note that to cross a red edge with a blue edge (or a red edge with another red edge) we can use the aforementioned crossover gadget, paired with red-blue conversion gadgets. Latch Gadget. The final gadget we require is the latch gadget (Figure 4). It can be unlocked by reversing the edge L, after which its state (the orientation of edge A, and adjacent edges) can be changed. The latch can be locked by reversing the edge L again. It is useful to reduce

A

(a) Constrained blue-edge terminator

A

(b) Free red-edge terminator

Figure 2 Gadgets for terminating loose edges. The constrained blue-edge terminator (a) forces the blue edge A to point into the gadget, while the free red-edge terminator (b) allows the red edge A to point out of the gadget.

T. C. van der Zanden

5

A C

D

B (a) Crossover

(b) Half-crossover

Figure 3 The crossover gadget (a) may be constructed with help of the half-crossover gadget (b).

L

A

Figure 4 The latch gadget can be (un-)locked by reversing edge L, and edge A may reverse if and only if the gadget is unlocked. The gadget is shown in its locked state.

C2E NCL problems to C2C NCL problems, replacing the target edge in the C2E problem by a latch gadget, and creating a C2C problem in which the goal configuration differs from the start configuration only in the state of the latch gadget.

2.3

H-Word Reconfiguration

To show hardness of NCL on bounded bandwidth graphs, we reduce from the H-Word Reconfiguration problem, introduced in [16]. I Definition 2 (H-word). Let H = (Σ, E) where Σ is an alphabet and E ⊆ Σ × Σ a relation. An H-word is a word over Σ such that every pair of consecutive characters (a, b) is an element of E. H-Word Reconfiguration Instance: Two H-words Ws , Wg of equal length Question: Is there a sequence of H-words W1 , . . . , Wn , so that every pair of consecutive words Wi , Wi+1 can be obtained from each other by changing one character to another and W1 = Ws , Wn = Wg ? I Theorem 3 (Wrochna [16]). There exists an H such that H-Word Reconfiguration is PSPACE-complete.

2.4

Graph Parameters

As one possible parametrization we consider treewidth. The main result (Theorems 9 and 10) considers graphs of bounded bandwidth, a subclass of graphs of bounded treewidth [2]. I Definition 4 (Treewidth). A tree decomposition of a graph G = (V, E), is a tree T in which every vertex t of T is associated with a bag Xt ⊆ V , such that: For all v ∈ V , there is a t such that v ∈ Xt For all (u, v) ∈ E, there is a t such that u ∈ Xt and v ∈ Xt

T. C. van der Zanden

For all v ∈ V , T [{t ∈ T : v ∈ Xt }] is connected The width of a tree decomposition is maxt∈T |Xt | − 1. The treewidth of G is the minimum width over all tree decompositions of G. The main result concerns graphs of bounded bandwidth. The proof of Theorem 19 uses the notion of cutwidth. I Definition 5 (Bandwidth [2]). Let G = (V, E) be a graph and define a one-to-one correspondence f : V → {1, . . . , |V |}. The bandwidth of a graph is the minimum over all such correspondences of max(u,v)∈E |f (u) − f (v)|. I Definition 6 (Cutwidth [2]). Let G = (V, E) be a graph and define a one-to-one correspondence f : V → {1, . . . , |V |}. The cutwidth of a graph is the minimum over all such correspondences of maxw∈V |{(u, v) ∈ E|f (u) ≤ f (w) < f (v)}|.

2.5

Dynamic Programming on Tree Decompositions

For some of the positive results in this paper, we use the technique of dynamic programming on tree decompositions. For an excellent survey of and introduction to this topic, see [1]. To simplify the algorithms, we assume tree decompositions are given in nice form, that is, all of the nodes of the tree decomposition are of one of the following types: Leaf : all leaves of the tree decomposition contain exactly one vertex. Introduce: a node with one child that contains the same set of vertices as its child, with the addition of one new vertex. Forget: a node with one child that contains the same set of vertices as its child, but with one vertex removed. Join: a node with two children so that both the node itself and both of its children contain the exact same set of vertices. Given a tree decomposition, it is possible to find a nice tree decomposition of the same width (and of linear size) in linear time.

3

Parametrization by Treewidth

3.1

Constraint Graph Satisfiability

We first examine Constraint Graph Satisfiability (CGS) with respect to treewidth tw and maximum degree ∆ as parameters. CGS is strongly NP-complete even for graphs where ∆ = 3 [10]. We show that CGS is weakly NP-complete for graphs of treewidth at most 2, but that CGS is fixed parameter tractable with respect to tw + ∆ and solvable in polynomial time for fixed tw if the input is given in unary. Note that even though CGS becomes fixed parameter tractable with respect to tw + ∆, its reconfiguration variant remains hard (Theorem 9) even when this parameter is bounded by a constant. I Theorem 7. Constraint Graph Satisfiability is weakly NP-complete on constraint graphs of treewidth 2. Proof. By reduction from Partition. Let x1 , . . . , xn ∈ N such that Σni=1 xi = 2N be an instance of Partition. Construct a constraint graph with vertices U, W with minimum inflow N , and vertices v1 . . . , vn where the minimum inflow of vi is equal to xi . For 1 ≤ i ≤ n, create edges (U, vi ), (W, vi ), both of weight xi . In any legal configuration for this constraint

6

T. C. van der Zanden

graph, either edge (U, vi ) or (W, vi ) must be directed towards vertex vi and the other edge will be directed towards either U or W . A solution to the partition problem and a legal configuration for the constraint graph correspond as follows: for all xi in one half of the partition, the edge (U, vi ) is directed towards U (and the edge (W, vi ) is directed towards vi ) and for all xi in the other half of the partition, the edge (W, vi ) is directed towards W (and the edge (U, vi ) is directed towards vi ). The graph restricted to vertices {v1 , . . . , vn , U } forms a tree, and thus the constraint graph itself has treewidth 2 (we can add the vertex W to all bags). We have thus shown CGS weakly NP-hard on constraint graphs of treewidth 2. J The following theorem shows that CGS can be solved in polynomial time on graphs of treewidth 2 when the input is given in unary (and completes the proof of theorem 7). I Theorem 8. Constraint Graph Satisfiability is fixed parameter tractable with respect to parameter tw + ∆ and solvable in time O∗ (|x|tw ) on constraint graphs of treewidth tw when the size of the input numbers given in unary is |x|. Proof. We provide a dynamic programming algorithm on tree decompositions. In the case where ∆ is a parameter, in each bag we store for every combination of orientations of the edges incident to vertices in that bag (at most 2∆(tw+1) combinations) whether that combination leads to a valid configuration for the subgraph induced by the subtree rooted at that bag. We assume that the tree decomposition is given as a nice tree decomposition: Leaf : In a leaf node, we enumerate all possible combinations of orientations for edges incident to this vertex (at most 2∆ ), and see which combinations satisfy the minimum inflow of that vertex. Introduce: In an introduce node, enumerate all combinations of orientations of edges incident to the vertices in the bag (at most 2∆(tw+1) ). A combination is valid if it satisfies the inflow of the vertex being introduced, and (when restricted to the appropriate edges) is also a valid assignment of orientations for the child bag. Forget: In a forget node, an assignment of orientations is valid if it can be extended (by picking appropriate orientations for the missing edges) to a valid configuration for the child bag. Join: In a join node, an assignment of orientations is valid if it is valid for both child nodes. The amount of work done in each bag is O∗ (2∆(tw+1) ), so the total running time is O (|I| · 2∆(tw+1) ), where |I| is the number of bags (which can be assumed to be linear in the size of the input graph, since there always a linear size tree decomposition). A similar algorithm can be used in the case where the input is given in unary. Instead of storing the orientations of the edges directly, we store only the resulting inflow values. For all possible combinations of inflow that the vertices in the bag can be receiving (at most |x|tw+1 combinations), we store whether that combination of inflows is attainable using only the edges present in the subgraph induced by the subtree rooted in that bag (i.e. edges to vertices in parent bags are not considered) in configurations that are legal for the vertices in the induced subgraph excluding the vertices in the bag itself. This requires (in particular) modification of the forget case, marking as invalid any inflow configurations that do not satisfy the minimum inflow of the vertex being forgotten (detection of whether a vertex is receiving sufficient inflow is deferred to the forget node instead of being checked in the leaf or introduce cases). J ∗

7

T. C. van der Zanden

3.2

Unbounded Nondeterministic Constraint Logic

In this section we prove the main result, namely that restricted Nondeterministic Constraint Logic remains PSPACE-complete even when restricted to graphs of bounded bandwidth (which is a subclass of graphs of bounded treewidth). To show PSPACE-completeness, we reduce from H-Word Reconfiguration. The bandwidth of the constraint graph created in the reduction will depend only on the size of H. Since H-Word Reconfiguration is PSPACE-complete for a fixed (finite) H, we obtain a constant bound on the bandwidth. I Theorem 9. There exists a constant c, such that C2C Nondeterministic Constraint Logic is PSPACE-complete on planar constraint graphs of bandwidth at most c that consist of only AND and OR vertices. Proof. Let H = (Σ, E) be so that H-Word Reconfiguration is PSPACE-complete. We provide a reduction from H-Word Reconfiguration to (unrestricted) NCL and then show how to adapt this reduction to work for restricted NCL. Let Ws , Wg be an instance of H-Word Reconfiguration and let n denote the length of Ws . In the following, all vertices are given minimum inflow 2. We create a matrix of vertices Xi,j for i ∈ {1, . . . , n}, j ∈ Σ, the character vertices. The orientation of edges incident to Xi,j will correspond to whether the character at position i in the word is character j. For every row i of this matrix we create a universal vertex Ui and for every j ∈ Σ we create a blue (weight 2) edge connecting Ui and Xi,j . In each row i ∈ 1, . . . , n − 1 and for all pairs (A, B) 6∈ E, we create a relation vertex ∆i,A,B . We create a red (weight 1) edge connected to Xi,A and pass it through a red-blue conversion gadget and connect the blue edge leaving the conversion gadget to ∆i,A,B . We mirror this construction, creating a red edge connected to Xi+1,B , converting it to blue, and connecting it to ∆i,A,B . Finally, we connect one additional blue edge to ∆i,A,B and connect it to a constrained blue-edge terminator. This edge serves no purpose (its inflow can never count towards ∆i,A,B ) but to make ∆i,A,B an OR vertex as claimed. A single instance of this construction is shown in figure 5, which depicts a slice of two rows from the matrix of vertices. Having created an instance of this construction for (A, B), we might need to create an instance for (A, C). Rather than attaching another red edge to Xi,A , we instead split the existing red edge leaving Xi,A by connecting it to a red-blue conversion gadget, and attaching the resulting blue edge to an AND vertex. The edges leaving the AND vertex may be oriented outward if and only if the red edge leaving Xi,A is oriented into the AND vertex, effectively splitting it. We then convert the two red edges of the AND vertex to blue and attach them to ∆i,A,B and ∆i,A,C as before. To create further copies of this construction we can repeat the splitting process, so that Xi,A eventually has two incident red edges, one connecting to gadgets in row i − 1 and one connecting to row i + 1 (the excess red edges in rows 1 and n may instead be connected to a free red edge terminator). We define a character j to be in the word at position i if the edge (Ui , Xi,j ) is oriented towards Ui . I Claim. In any legal configuration, at least one character is in the word at each position. Proof. Ui has minimum inflow 2, so at least one of its incident edges (Ui , Xi,j ) must be oriented towards it and hence j is in the word at position i. J

8

T. C. van der Zanden

9

Ui

Xi,A

Xi,B

Xi,C

Xi,D

Xi+1,B

Xi+1,C

Xi+1,D

∆i,A,B

Xi+1,A

Ui+1

Figure 5 Slice of two rows from the matrix of vertices (over an alphabet of Σ = {A, B, C, D}), and the construction for enforcing non-adjacency of A and B.

I Claim. In any legal configuration, if (A, B) 6∈ E then A can be in the word at position i only if B is not in the word at position i + 1. Proof. If A is in the word at position i, then Xi,A is not receiving inflow from Ui , so both of the red edges incident to Xi,A most point in towards Xi,A . On the path from Xi,A through ∆i,A,B to Xi+1,B we will first pass through a red-blue conversion gadget. Since the red edge is oriented out of the conversion gadget (and towards Xi,A ), the blue edge must be oriented into the conversion gadget. We may then encounter several AND vertices (that are used for the “splitting” of red edges incident to Xi,A ), note that since the blue edge is oriented towards the conversion gadget and away from the AND vertex, both red edges must be oriented into the AND vertex. This means that when we encounter another red-blue conversion gadget its blue edge must be oriented into the AND vertex and in turn the red edge incident to the conversion gadget has to be oriented into the conversion gadget. Ultimately, when we arrive at the vertex ∆i,A,B we find that one of its edges must be oriented out of it (to point into the previously described AND vertices and help satisfy the minimum inflow of Xi,A ). Suppose by contradiction that B is in the word at position i + 1. By a similar argument, we find that the second edge incident to ∆i,A,B also has to be oriented out of it. This is impossible, since the third blue edge incident to ∆i,A,B is also oriented out of it (since that edge is attached to a constrained blue-edge terminator gadget) and thus its minimum inflow constraint is violated. Therefore B can not be in the word at position i + 1. J Note that this claim implies that if for each position we pick some character that is in the position at that word, we end up with a valid H-Word. We say that a configuration for the constraint graph encodes a word W if each of that word’s characters is in the word at the appropriate position. I Claim. If a legal configuration for the constraint graph encoding Ws may be reconfigured into a legal configuration encoding only Wg (i.e. the configuration encodes no other word), then Ws may be reconfigured into Wg .

T. C. van der Zanden

Proof. Suppose we have a reconfiguration sequence of legal configurations C1 , . . . , Cm so that C1 encodes Ws and Cm encodes only Wg . We define a reconfiguration sequence of words W1 , . . . , Wm which has the property that Ci encodes Wi . Let W1 = Ws , we recursively define Wi , 1 < i ≤ m as follows: Since Ci+1 differs from Ci in the orientation of only one edge, the set of words encoded by Ci+1 differs only from the set of words encoded by Ci by making one character at a position allowed (in the word) or disallowed (was in the word in Ci but not in the word in Ci+1 ). If a character at a position becomes allowed in Ci+1 , let Wi+1 = Wi (since Ci encodes Wi , Ci+1 also encodes Wi ). If a character at a position becomes disallowed (i.e. is no longer in the word), we obtain Wi+1 from Wi by changing the character at that position to some allowed character (of which there is at least one). Following these steps, since the final configuration encodes only Wg , we obtain a reconfiguration sequence from Ws to Wg as claimed. J Note that we may have multiple choices for Wi because Ci can encode more than one word. It suffices to simply pick one of the words it encodes, while ensuring it differs in at most one character from the previous and next. I Claim. Given a H-word W of length n, there exists a legal configuration for the constraint graph encoding only W . Proof. Pick the orientation of edge (Ui , Xi,j ) to be towards Ui if the character in W at position i is j, and towards Xi,j otherwise. Clearly this constraint graph encodes only W . This configuration can be extended to a legal configuration for the remaining (relation) vertices by noticing the following: if there is a relation vertex ∆i,A,B then either A is not in the word at position i or B is not in the word at position j. Suppose w.l.g. that B is not in the word, then Xi+1,B is receiving inflow from Ui+1 and hence its incident red edges may be pointing outwards, which (after passing through the red-blue conversion gadgets and splitting AND vertices as described before) allows us to satisfy the inflow requirement of ∆i,A,B . J I Claim. If two H-Words W1 , W2 differ by only one character, then a constraint graph G encoding only W1 can be reconfigured into one encoding only W2 . Proof. Suppose that W1 and W2 differ by changing the character at position i from A to B. We may first reconfigure G from encoding only W1 to encoding both W1 and W2 , and then reconfigure it to encode only W2 . This temporarily increases the inflow Ui receives from 2 (receiving inflow only from Xi,A ) to 4 (receiving inflow from both Xi,A and Xi,B ) back to 2 (receiving inflow from only Xi,A ). It may be required to reorient some edges to satisfy the inflows of the relation vertices, but this is always possible because neither A nor B conflicts with any preceding or succeeding characters. J Note that this claim implies that if Ws can be reconfigured into Wg , then a constraint graph encoding only Ws can be reconfigured into one encoding only Wg . This completes the reduction. All that remains to show is that this graph can be adapted so that it only uses AND and OR vertices and becomes planar, and that the resulting graph has bounded bandwidth. The only vertices that are not already AND or OR vertices are the universal vertices Ui . Note that taking a single OR vertex (that has 3 incident edges at least one of which has to be oriented inwards) we can attach another OR vertex to one of its edges to obtain a structure that has 4 external edges, at least one of which has to be oriented inwards. Repeating this

10

T. C. van der Zanden

procedure n times we obtain a tree of OR vertices with n + 3 external edges, at least one of which has to be oriented inwards, which can replace the universal vertex. To make the graph planar, we can use Hearn and Demaine’s crossover gadget [10]. While this may increase the graph’s bandwidth, the following argument that it remains bounded by a constant: We create a number of bags B1 , . . . Bn−1 that are subsets of vertices, with the property that the size of each bag depends only on H (which is fixed) and that edges connect only vertices that are both in the same bag, or a vertex in bag Bi with a vertex in bag Bi+1 . This is achieved by taking in bag i the vertices {Xi,j : j ∈ Σ}, {∆i,A,B (A, B) 6∈ E}, {Xi+1,j : j ∈ Σ}, the vertices in gadgets between them (i.e. the red-blue conversion gadgets and AND vertices used in the splitting process) and the construction replacing the universal vertices Ui and Ui+1 . This shows the bandwidth of the graph is bounded by a constant c, since we can order the vertices so that a vertex in Bi precedes a vertex in Bi+1 (and pick an arbitrary order for the vertices in the same bag). We have thus shown how to reduce H-Word Reconfiguration to NCL, shown how to adapt our reduction to use only AND and OR vertices and make the resulting graph planar and that the resulting graph has bounded bandwidth and have thus shown Theorem 9. J Theorem 9 also holds for C2E Nondeterministic Constraint Logic: I Theorem 10. There is a constant c, such that C2E Nondeterministic Constraint Logic is PSPACE-complete, even on planar constraint graphs of treewidth (bandwidth) at most c that use only AND and OR vertices. Proof. H-Word Reconfiguration remains PSPACE-complete, even when instead of requiring that one H-word is reconfigured in to another, we ask whether it is possible to reconfigure a given H-word so that a given character appears at a specific position (without requiring anything regarding the remaining characters in the word). This can be seen by examining the proof in [16], noting that we may modify the Turing machine to, upon reaching an accepting state, move the head to the start of the tape and write a specific symbol there. The proof of Theorem 9 can then easily be adapted to work for C2E NCL (since a character appearing at a specific position corresponds to reversing a specific edge). J We note that Theorems 9 and 10 may be further strengthened by requiring that all OR vertices in the graph are protected, i.e., in any legal configuration at least one of its incident edges is directed outwards. Hearn and Demaine [10] show how to construct an OR vertex using only AND vertices and protected OR vertices.

3.3

Bounded Nondeterministic Constraint Logic

We now consider the bounded variant of NCL, in which each edge is allowed to reverse at most once. We show that the bounded variants of NCL are weakly NP-hard on graphs of treewidth at most 2, but, unlike their unbounded variants, fixed parameter tractable when parameterized by tw + ∆. I Theorem 11. Bounded NCL (both C2E and C2C) is weakly NP-hard on constraint graphs of treewidth 2. Proof. By reduction from Partition. Construct an NCL graph in the same manner as in the proof of Theorem 7, but create an additional edge (U, W ) of weight N . In the initial configuration, let the edge (U, W ) be directed towards W , the edges (U, vi ) towards U and the edges (W, vi ) towards vi .

11

T. C. van der Zanden

For the C2E variant, ask whether it is possible to reverse the edge (U, W ). For the C2C variant, ask whether the configuration in which all edges are reversed is reachable. It is possible to reverse (U, W ) is and only if there is a partition: initially, vertex U is receiving 2N units of inflow (from the edges (W, vi )) and V is receiving N units of inflow (from the edge (U, W )). To reverse (U, W ), we must reverse some of the edges (U, vi ) and (W, vi ) so that W is receiving exactly N units of inflow from them. If W is receiving less than N units of inflow from these edges it is not possible to reverse (U, W ), if it is receiving more than N inflow then V would not be receiving enough inflow. Being able to select these edges so that W receives exactly N units of inflow from them corresponds to a partition. This completes the proof for the C2E variant. For the C2C variant, note that after reversing (U, W ) we may reverse the remaining edges (that have not been reversed yet) while the graph remains satisfied: after reversing (U, W ), U is receiving 2N units of inflow and W is receiving N units, after reversing the remaining edges U will be receiving N units of inflow and W will be receiving 2N units. J Bounded NCL (on graphs of treewidth 2) is clearly in NP, however, it is not clear whether there exists a pseudopolynomial algorithm for the problem, so we can not claim weak NP-completeness. This is an open problem. I Theorem 12. Bounded NCL (both C2E and C2C) is fixed parameter tractable with respect to parameter tw + ∆. Proof. The problems can be solved by dynamic programming on tree decompositions. For every bag, we consider all possible sequences of reversing the edges in that bag (since each edge may be reversed at most once, there are at most (∆tw)! such sequences) that result in a valid solution for the subgraph induced by the subtree rooted at that bag. For C2C, we additionally require that a reversal sequence reverses exactly those edges that need to be reversed. For C2E, we additionally require that the reversal sequence reverses the target edge. We assume that the tree decomposition is given as a nice tree decomposition: Leaf : Enumerate all reversal sequences of incident edges (at most ∆!). For the C2C variant, a sequence is valid if it reverses exactly the edges that must be reversed and additionally respects the minimum inflow of the vertex. For C2E, all sequences that respect the minimum inflow of the vertex are valid, unless the vertex is incident to the target edge in which case we additionally require that a valid reversal sequence reverses the target edge. Introduce: Enumerate all reversal sequences of incident edges (at most (∆tw)! sequences). A sequence is valid if it is valid for the vertex being introduced (as described in the leaf case) and also valid for the child bag (when restricted to the appropriate edges). Forget: A reversal sequence is valid if and only if it can be extended (by introducing reversal operations for the missing edges) to a valid reversal sequence for the child bag. Note that this is simply a projection of the reversal sequences valid for the child. Join: A reversal sequence is valid if and only if it is valid for both child bags. Since checking whether a reversal sequence is valid can be done in polynomial time (if the memoization tables are stored in a suitable data structure), the amount of work done in each bag is O∗ ((∆tw)!). Since the number of bags can be assumed to be linear [1], this gives a fixed-parameter tractable algorithm. J

12

T. C. van der Zanden

4

Parametrization by Solution Length

We consider parametrization by the length of the reconfiguration sequence l. This parameter does not bound the input size, but rather bounds the set of potential solutions considered. It asks not whether a reconfiguration sequence exists, but whether a reconfiguration sequence exists that has length (number of edge reversals) at most l. This parametrization does not apply to CGS (since it does not have such a notion), we thus consider this parametrization only for C2E and C2C NCL and their respective bounded variants. I Theorem 13. (Unbounded) C2E, C2C and bounded C2E Nondeterministic Constraint Logic are W[1]-hard with respect to l. Proof. We show W[1]-hardness by reduction from k-Clique, which is W[1]-complete due to Downey and Fellows [5]: Let G = (V, E) be an instance of k-Clique. Let n = |V | and let ∆ be the maximum degree of G. We create a constraint graph with vertices v1 , . . . , vn (copies of the original vertices from G) with minimum inflow equal to that vertex’ degree in G, vertices v(i,j) with minimum inflow 2 for all edges (i, j) ∈ E, and three additional vertices U, V, W with minimum inflows n − ∆ · k, k(k − 1) and 0 respectively. For every edge (i, j) ∈ E, two edges in the constraint graph are created: an edge (vi , v(i,j) ) and an edge (v(i,j) , vj ), both with weight 1. Effectively, the edge (i, j) is split and an additional vertex v(i,j) is added between vertices vi and vj . In the initial configuration, both edges are oriented away from v(i,j) (and towards vi and vj ). Note that after adding these edges, the minimum inflow constraints in all vertices v1 , . . . , vn are satisfied (since their minimum inflow is equal to their degree). For every vertex vi , add an edge (U, vi ) to the graph with weight ∆. The edge is oriented towards U in the initial configuration, satisfying its inflow constraint. For every edge (i, j) ∈ E, create an edge (v(i,j) , V ) of weight 2, oriented towards v(i,j) in the initial configuration. This satisfies the minimum inflow constraint of v(i,j) . Finally, create an edge (V, W ) of weight k(k − 1), oriented towards V in the initial configuration, thus satisfying V ’s minimum inflow. This edge is the target edge. Note that W ’s minimum inflow is trivially satisfied. The target edge (V, W ) can be reversed if and only if we have first reversed k(k−1) of the 2 weight 2 edges to point in to V (or else V ’s inflow constraint would no longer be satisfied after reversing (V, W ). A weight 2 edge (v(i,j) , V ) can be reversed if and only if we have first reversed the weight 1 edges (vi , v(i,j) ) and (v(i,j) , vj ) (or else v(i,j) ’s minimum inflow would not remain satisfied). This in turn is possible if and only if both edges (U, vi ) and (U, vj ) have been reversed. Because the minimum inflow of U is n − ∆ · k, we may reverse at most k edges to point away from U . Since we may reverse the edge (v(i,j) , V ) if and only if both edges (U, vi ) and (U, vj ) have been reversed, the NCL instance thus constructed has a solution if and only if there are k vertices in G such that G restricted to these vertices has k(k−1) edges. This 2 corresponds to these vertices forming a clique. We have thus reduced k-Clique to C2E NCL. Note that if the instance created in the reduction has a solution of any length, then it has a solution of length at most O(k 2 ) in which each edge reverses at most once. Hence the reduction is parameter-preserving, and works for both bounded and unbounded C2E NCL which we have thus shown W[1]-hard. To show W[1]-hardness for C2C NCL, we replace the vertex W with a latch gadget. The latch gadget has two states, and can change between these states if and only if the edge (U, W ) is pointing in to it. We ask whether there is a reconfiguration sequence that changes

13

T. C. van der Zanden

the state of the latch gadget, but where all the other edges are in their initial orientation. Such a sequence exists if and only if (in the original instance) it is possible to reverse the edge (U, W ), since we may first reverse (U, W ), activate the latch gadget, and then backtrack to return the rest of the graph to its original state. J We note that hardness is in the strong sense, since the weights of the edges and vertices are polynomial in the input size. However, the problems may become fixed parameter tractable if we include the maximum weight of an edge or vertex as parameter. This is an open problem. The construction using the latch gadget does not work for bounded C2C NCL, since each edge can only be reversed once. Effectively, the hardness of NCL when parameterized by solution length is not due to the complexity of finding a reconfiguration sequence, but rather that of finding a suitable goal configuration. This is captured by the following theorem: I Theorem 14. Bounded C2C Nondeterministic Constraint Logic is fixed parameter tractable in O∗ (2l ) time. Proof. If the number of edges that differ in orientation between the goal and start configuration exceeds l, we may reject immediately because is is impossible to reverse all of them in l moves. We may thus assume at most l edges need to be reversed. Since in bounded NCL each edge may be reversed at most once, feasible solutions consist of some order of reversing the edges that need to be reversed; reversing an edge that does not need to be reversed makes the instance unsolvable, and reversing an edge more than once is not possible. There are thus at most l! solutions each of which can be evaluated in polynomial time. This can be improved to a O∗ (2l ) time algorithm using a dynamic programming approach, similar to the Held-Karp algorithm [11] for TSP. J Parametrization by Maximum Degree. The graphs created by the reduction in the proof of Theorem 13 may have arbitrary degree, while Hearn et al. [10] consider only graphs of maximum degree 3. We show that the hardness result of Theorem 13 is strict in this regard, that is, when we parameterize by the maximum degree ∆ in addition to l, the problem becomes fixed parameter tractable. I Theorem 15. Both bounded and unbounded C2E and C2C Nondeterministic Constraint Logic are fixed parameter tractable with respect to l + ∆. Proof. For the C2E variants, note that an edge that is at a distance greater than or equal to l from the target edge never needs to be reversed in a solution of length at most l: The only valid solution of length at most 1 is to reverse the target edge, which indeed is at distance 0 from itself. Consider a solution of length at most l + 1 and that it reverses an edge e at distance l + 1 or greater from the target edge. After this edge is reversed, we are left with a solution of length at most l which by induction only needs to reverse edges at distances less than l from the target edge. We note that we can omit the reversal of e from the reconfiguration sequence, since the vertex that gains inflow as a result of that reversal is not incident to any of the edges reversed subsequently, and hence omitting this reversal also results in a valid solution. For any candidate solution, we only need to consider edges at distance at most l − 1 from the target edge, of which there are at most O((∆ − 1)l−1 ). We may omit the other edges from the graph (adjusting the minimum inflows of their incident vertices according to the initial orientations of the edges) and consider only the graph restricted to these edges and their incident vertices.

14

T. C. van der Zanden

15

In the C2C variants, similar to the proof of Theorem 14, we may assume at most l edges need to be reversed. We can thus bound the size of the set of edges that can be reversed in any candidate solution by O(l(∆ − 1)l−1 ), since as before, for any of the l edges needing to be reversed, we are only concerned with the edges at distance at most l from that edge. As before, we can omit the remaining edges from the graph. The problems thus admit kernelizations and therefore are fixed parameter tractable. J

5

Applications

As a result of our hardness proof for NCL, we (nearly) automatically obtain tighter bounds for other problems that reduce from NCL in their hardness proofs. If the reduction showing PSPACE-hardness for a problem is bandwidth-preserving in the sense that the bandwidth of the resulting graph only depends on the bandwidth of the original constraint graph, then that problem remains PSPACE-hard even when limited to instances of bounded bandwidth. Since reductions from NCL usually work by locally replacing AND and OR vertices in the graph with gadgets that simulate their functionality, such reductions are often bandwidth-preserving. Independent Set Reconfiguration (IS-R) Instance: Graph G = (V, E), independent sets Ss , Sg ⊆ V of G, integer threshold k. Question: Is there a sequence of independent sets S1 , . . . , Sn , so that for all i, Si+1 is obtained from Si by the addition or removal of one vertex, |Si | ≥ k and S1 = Ss , Sn = Sg ? This is the token addition-and-removal (TAR) version of IS-R. It is also possible to define a token jumping (TJ) variant (in which we obtain one independent set from the next by removing and immediately replacing a vertex) and a token sliding variant (in which when we remove a vertex, we must replace it with an incident vertex, i.e. "sliding" the token/vertex along an edge). I Theorem 16. TAR, TJ and TS versions of Independent Set Reconfiguration are PSPACE-complete on planar, maximum degree 3 graphs of bounded bandwidth. Proof. Hearn and Demaine [9] provide a reduction from IS-R to TJ and TS versions of IS-R. The gadgets used in their reduction are reproduced in figure 6. Since the reduction works by replacing every vertex with a construction of at most 6 other vertices, the bandwidth of the graph created in the reduction is at most 6 times the bandwidth of the original constraint

(a) OR vertex

(b) AND vertex

Figure 6 Gadgets used in the reduction from IS-R to NCL. Dashed vertices represent vertices that are part not of the gadget itself, but of other gadgets. The dark gray vertices represent an example independent set.

T. C. van der Zanden

graph. The theorem thus follows immediately from our hardness result and Hearn and Demaine’s reduction [9] and the fact that the TAR version is equivalent to TJ [13]. J Similarly to Independent Set Reconfiguration, we can define reconfiguration versions of Vertex Cover (VC-R), Feedback Vertex Set (FVS-R), Induced Forest (IF-R), Odd Cycle Transversal (OCT-R) and Induced Bipartite Subgraph (IBS-R). Note that for IS-R, IF-R, IBS-R the size of the vertex subset is never allowed to drop below the threshold, while for VC-R, FVS-R and OCT-R the size is never allowed to exceed the threshold. These problems are PSPACE-complete on bounded bandwidth graphs by reduction from H-Word Reconfiguration [14]. We strengthen this result, noting that our proof follows the same reasoning as in [14]: I Theorem 17. TAR, TJ and TS versions of Independent Set (IS-R), Vertex Cover (VC-R), Feedback Vertex Set (FVS-R), Induced Forest (IF-R), Odd Cycle Transversal (OCT-R) and Induced Bipartite Subgraph (IBS-R) are PSPACE-complete on planar graphs of bounded bandwidth and low maximum degree. Proof. By Theorem 16, IS-R is PSPACE-complete on planar graphs of bounded bandwidth and maximum degree 3. Since an independent set is the complement of a vertex cover, the theorem holds for VC-R on maximum degree 3 graphs. By replacing every edge in the graph by a triangle, we can reduce VC-R to FVS-R (since picking at least one vertex of every edge is equivalent to picking at least one vertex of every triangle), thus showing the theorem for FVS-R on maximum degree 6 graphs. We note that in such a graph a feedback vertex set is also an odd cycle transversal, thus also showing the theorem for OCT-R on maximum degree 6 graphs. Finally, the theorem holds for IF-R and IBS-R on maximum degree 6 graphs by considering complements of solutions for FVS-R and OCT-R. J Another related reconfiguration problem is that of Dominating Set Reconfiguration (DS-R). In [7], the authors show that DS-R is PSPACE-complete on planar graphs of maximum degree six by reduction from NCL and PSPACE-complete on graphs of bounded bandwidth by a reduction from VC-R. The following theorem that unifies these results follows immediately from our improved result concerning VC-R: I Theorem 18. The TAR version of Dominating Set Reconfiguration is PSPACEcomplete, even on planar, maximum degree six graphs of bounded bandwidth. The puzzle game Rush Hour, in which the player moves cars horizontally and vertically with the goal to free a specific car from the board, is PSPACE-complete [6] when played on an n × n board. Another consequence of our result is that Rush Hour is PSPACE-complete even on rectangular boards where one of the dimensions of the board is constant: I Theorem 19. There exists a constant k, so that Rush Hour is PSPACE-complete when played on boards of size k × n. Proof. Hearn and Demaine [9] provide a reduction from restricted NCL, showing how to construct AND and OR vertices as gadgets in Rush Hour and how to connect them together using straight line and turn gadgets. Given a planar constraint graph, it can be drawn in the grid (with vertices on points of the grid and edges running along the lines of the grid), after which vertices can be replaced by their appropriate gadgets and edges with the necessary line and turn gadgets. However, starting with a graph of bounded bandwidth does not

16

T. C. van der Zanden

immediately give a suitable drawing in a grid of which one of the dimensions is bounded (from which the theorem would follow, since all of the gadgets have constant size). Given a restricted NCL graph of bounded bandwidth, we note that this graph also has bounded cutwidth [2]. Given such a graph with n vertices and cutwidth at most c, it is possible to arrange it in a (c + 1) × 3n grid, so that vertices of the graph are mapped to vertices of the grid, the edges of the graph run along edges of the grid, and no two edges or vertices get mapped to the same edge or vertex in the grid. This is achieved by placing all of the vertices of the graph in a single column (noting that 3 rows are required for each vertex since it has 3 incident edges) and (due to the graph having cutwidth c) the edges can be placed in the remaining c columns (placing each edge in a distinct column). However, even when starting with a planar NCL graph, the resulting embedding may have crossings. These can be eliminated using the crossover gadget, noting that since the crossover gadget has constant size, the resulting graph can still be drawn in a O(c) × O(n) grid. We can now use the existing gadgets from [9] to finish the reduction, showing Rush Hour PSPACE-complete on boards of which one of the dimensions is bounded by a constant. J Note that this result is likely to carry over to show other board games PSPACE-complete on n × k boards, such as Sokoban or Plank Puzzles, which also reduce from NCL in their hardness proofs [10]. This result is in contrast to [15], where it is shown that Peg Solitaire, when played on k × n boards, is linear time solvable for any fixed k. An important distinction here is that the length of a solution in a Peg Solitaire game is bounded by the number of pegs (since every move removes one peg from play) whereas Rush Hour games are unbounded: any length move sequence is possible, though obviously after an exponential number of moves, positions would be repeated.

6

Conclusions

We have studied the parameterized complexity of constraint logic problems with regards to (combinations of) solution length, maximum degree and treewidth as parameters. As a main result, we showed that restricted Nondeterministic Constraint Logic remains PSPACE-complete on graphs of bounded bandwidth, strengthening Hearn and Demaine’s framework [10]. We showed that when parameterized by solution length, C2E, C2C and bounded C2E variants of Nondeterministic Constraint Logic are W[1]-hard, but bounded C2C NCL becomes fixed parameter tractable. Essentially, the hardness of bounded C2E NCL when parameterized by solution length is due to the complexity of finding a suitable target configuration, rather than from that of determining a reconfiguration sequence. However, when parametrizing by maximum degree in addition to solution length, all cases become fixed parameter tractable. When parameterized by treewidth, Constraint Graph Satisfiability becomes weakly NP-complete (rather than strongly NP-complete). When considering maximum degree in addition to treewidth, CGS becomes fixed parameter tractable. Note that this is in stark contrast to the complexity of NCL, which remains PSPACE-complete even for fixed values of this parameter. This is an interesting example of how reconfiguration problems can be much harder than their decision variants. Bounded NCL also becomes fixed parameter tractable when parameterized by treewidth and maximum degree. In the case where bounded NCL is parameterized by treewidth alone

17

T. C. van der Zanden

we proved weak NP-hardness. It is an open problem whether there exists a pseudopolynomial algorithm for this case, or if the problem is also strongly NP-complete. By combining Wrochna’s proof [16] and Hearn and Demaine’s [10] constraint logic techniques, we have managed to get the best of both worlds: for several reconfiguration problems, we showed hardness for graphs that are not only planar and have low maximum degree, but that also have bounded bandwidth. This not only strengthens Wrochna’s results, but also makes it easier to prove hardness for reconfiguration on bounded bandwidth graphs by merging H-Word Reconfiguration into the more convenient NCL framework. Note that the constant c in Theorem 9 has not been calculated precisely, but an informal analysis of Wrochna’s proof [16] and our reduction suggests it is very large (growing with the 12th power of the original instance size). This raises two open questions: one is to determine a tighter bound on the value of c, and the other is to determine whether efficient algorithms exist for solving reconfiguration problems when the graph’s bandwidth is bounded by more practical values. Some progress in this direction has already been made [4]. We have studied the parameterized complexity of CGS and NCL. Hearn and Demaine [10] have defined several other problems related to constraint graphs, including two player and multiple player constraint graph games, complete for classes such as EXPTIME and NEXPTIME. Studying these problems in a parameterized setting gives rise to several interesting open problems. Acknowledgement. I thank my advisor, Hans Bodlaender, for his guidance and useful comments and suggestions. References 1 2 3