Reconfiguring Undirected Paths
Erik D. Demaine, David Eppstein, Adam Hesterberg, Kshitij Jain, Anna, Lubiw, Ryuhei Uehara, Yushi Uno

TL;DR
This paper studies the problem of reconfiguring fixed-length paths in undirected graphs through edge additions and removals, providing efficient algorithms for trees and fixed-parameter cases, but proving PSPACE-completeness in certain graph classes.
Contribution
It introduces algorithms for reconfiguring paths in trees and fixed-parameter cases, and establishes computational hardness in graphs of bounded bandwidth.
Findings
Linear-time solution for trees
Fixed-parameter tractability for certain parameters
PSPACE-completeness in graphs of bounded bandwidth
Abstract
We consider problems in which a simple path of fixed length, in an undirected graph, is to be shifted from a start position to a goal position by moves that add an edge to either end of the path and remove an edge from the other end. We show that this problem may be solved in linear time in trees, and is fixed-parameter tractable when parameterized either by the cyclomatic number of the input graph or by the length of the path. However, it is PSPACE-complete for paths of unbounded length in graphs of bounded bandwidth.
Peer Reviews
No public reviews on file for this paper yet. If you reviewed it on a platform where reviews are public (OpenReview, ICLR, NeurIPS, ICML), you can paste yours below so the community can read it here.
Videos
No videos yet. Explain this paper in a talk, walkthrough, or lecture? Add one.
Taxonomy
TopicsAdvanced Graph Theory Research · Interconnection Networks and Systems · VLSI and FPGA Design Techniques
Reconfiguring Undirected Paths
Erik D. Demaine MIT Computer Science and Artificial Intelligence Laboratory, 32 Vassar St., Cambridge, MA 02139, USA, [email protected]
David Eppstein Computer Science Department, University of California, Irvine, Irvine, CA 92697, USA, [email protected]. Supported in part by NSF grants CCF-1618301 and CCF-1616248.
Adam Hesterberg MIT Mathematics Department, 77 Massachusetts Ave., Cambridge, MA 02139, USA, [email protected]
Kshitij Jain University of Waterloo, Canada, [email protected]
Anna Lubiw University of Waterloo, Canada, [email protected]
Ryuhei Uehara Japan Advanced Institute of Science and Technology, Nomi, Japan, [email protected]
Yushi Uno Graduate School of Engineering, Osaka Prefecture University, Japan, [email protected]
Abstract
We consider problems in which a simple path of fixed length, in an undirected graph, is to be shifted from a start position to a goal position by moves that add an edge to either end of the path and remove an edge from the other end. We show that this problem may be solved in linear time in trees, and is fixed-parameter tractable when parameterized either by the cyclomatic number of the input graph or by the length of the path. However, it is -complete for paths of unbounded length in graphs of bounded bandwidth.
1 Introduction
In this paper, we consider the problem of sliding a fixed-length simple path within an undirected graph from a given starting position to a given goal position. The path may move in steps where we add an edge to either end of the path and simultaneously remove the edge from the opposite end, maintaining its length. Effectively, this can be thought of as sliding the path one step along its length in either direction. The allowed movements of the path are similar to those of trains in a switchyard, or of the model trains in any of several train shunting puzzles; the edges of the path can be thought of as the cars of a train. However, unlike train tracks, we do not constrain connections at junctions of track segments to be smooth: a path that enters a vertex along an incident edge can exit the vertex along any other incident edge. Additionally, we do not distinguish the two ends of the path from each other.
Our aim is to understand the computational complexity of two natural reconfiguration problems for such paths: the decision problem, of testing whether it is possible to reach the goal position from the start position, and the optimization problem, of reaching the goal from the start in as few moves as possible. One natural upper bound for the complexity of these problems is the size of the state space for the problem, a graph whose vertices are paths of equal length on the given graph and whose edges represent moves from one path to another (Figure 1). If a given graph has paths of the given length, and moves from one path to another, we can solve either the decision problem or the optimization problem in time (after constructing the state space) by a simple breadth-first search. As we will see, it is often possible to achieve significantly faster running times than this naive bound. On the other hand, the general problem is hard, even on some highly restricted classes of graphs.
Specifically, we prove the following results:
The decision problem for path reconfiguration is fixed-parameter tractable when parameterized by the length of the path. This stands in contrast to the size of the state space for the problem which (for paths of length in -vertex graphs) can have as many as states. 2. 2.
For paths of unbounded length in graphs parameterized by the circuit rank, both the decision and the optimization problems can be solved in fixed-parameter tractable time by state space search. The same problem can be solved in polynomial (but not fixed-parameter tractable) time when parameterized by feedback vertex set number. 3. 3.
The optimization problem for path reconfiguration in trees can be solved in linear time, even though the state space for the problem has quadratic size. 4. 4.
The decision problem for path reconfiguration is -complete for paths of unbounded length, even when restricted to graphs of bounded bandwidth. Therefore (unless ) path reconfiguration is not fixed-parameter tractable when parameterized by bandwidth, treewidth, or related graph parameters.
1.1 Related work
There has been much past research on reconfiguring structures in graphs, with motivations that include motion planning, understanding the mixing of Markov chains and bounding the computational complexity of popular games and puzzles. See, for instance, Ito et al. [12] for many early references, and Mouawad et al. [14] for more recent work on the parameterized complexity of these problems. Often, in these problems, one considers moves in which the structure changes by the removal of one element and the addition of an unrelated replacement element (token moving) or in which an element of the structure changes only locally, by moving along an edge of the graph (token sliding).
Several authors have considered problems of reconfiguring paths or shortest paths under token jumping or token sliding models of reconfiguration [13, 3, 8]. However, the path sliding moves that we consider are different. Token sliding moves only a single vertex or edge of a path along a graph edge, while we move the whole path. And although our path sliding moves can be seen as a special case of token jumping, because they remove one edge and add a different edge, token jumping in general would allow the replacement of edges or vertices in the middle of a path, while we allow changes only at the ends of the path.
The path reconfiguration problem that we study here is also closely related to a popular video game, Snake, which has a very similar motion to the path sliding moves that we consider. Our problem differs somewhat from Snake in that we consider bidirectional movement, while in Snake the motion must always be forwards. Snake is typically played on grid graphs, and it is known to be -complete to determine whether the Snake can reach a specific goal state from a given start state on generalized grid graphs [4]. Independently of our work, Gupta et al [7] have found that reconfiguring snakes (paths that can move only unidirectionally) is fixed-parameter tractable in the length of the path, analogously to our Theorem 3.1.
2 Preliminaries
2.1 Reconfiguration sequences and time reversal
Definition 1
We define a reconfiguration step in a graph to be a pair of edges , and a reconfiguration sequence to be a sequence of reconfiguration steps. We may apply a reconfiguration step to a path by adding edge to and removing edge , whenever is one of the two edges at the ends of , is incident to the vertex at the other end, and the result of the application is another simple path. We may apply a reconfiguration sequence to a path by performing a sequence of applications of its reconfiguration steps. If applying reconfiguration sequence to path produces another path we say that we can reconfigure into or that takes to .
If is a reconfiguration step, then we define its time reversal to be the step . We define the time-reversal of a reconfiguration sequence to be the sequence of time reversals of the steps of , taken in the reverse order. If takes to , then its time reversal takes to . For this reason, when we seek the existence of a reconfiguration sequence (the path reconfiguration decision problem) or the shortest reconfiguration sequence (the path reconfiguration optimization problem), reconfiguring a path to is equivalent under time reversal to reconfiguring to . We call this equivalence time-reversal symmetry.
We define the length of a path to be its number of edges, and the length of a reconfiguration sequence to be its number of steps.
2.2 Tree-depth
Tree-depth is a graph parameter that can be defined in several equivalent ways [15], but the most relevant definition for us is that the tree-depth of a connected graph is the minimum depth of a rooted tree on the vertices of such that each edge of connects an ancestor-descendant pair of (Figure 2). Here, the depth of a tree is the length of the longest root-to-leaf path. Another way of expressing the connection between and is that is a depth-first search tree for a supergraph of . For disconnected graphs one can use a forest in place of a tree, but we will only consider tree-depth for connected graphs.
Tree-depth is a natural graph parameter to use for path configuration, because it is closely connected to the lengths of paths in graphs. If a graph has maximum path-length , then clearly its tree-depth can be at most , because any depth-first search tree of itself will achieve that depth. In the other direction, a graph with tree-depth has maximum path-length at most , as can be proven inductively by splitting any given path at the vertex closest to the root of a tree realizing the tree-depth. Therefore, the tree-depth and maximum path-length are equivalent for the purposes of determining fixed-parameter tractability. The parameterized complexity of reconfiguration problems on graphs of bounded tree-depth has been studied by Wrochna [17]. However, these graphs are highly constrained, so algorithms that are parameterized by tree-depth are not widely applicable.
We will prove as a lemma that path reconfiguration is fixed-parameter tractable for the graphs of bounded tree-depth. Because these graphs have bounded path lengths, this result will be subsumed in our theorem that path reconfiguration is fixed-parameter tractable when parameterized by path-length. However, we will use this lemma as a stepping-stone to the theorem, by proving that in arbitrary graphs we can either find a structure that allows us to solve the problem easily or restrict the input to a subgraph of bounded tree-depth.
3 Parameterized by path length
In this section we show that path reconfiguration is fixed-parameter tractable when parameterized by path length. As discussed above, our strategy is to find a structure (loose paths, defined below), whose existence allows us to solve the reconfiguration problem directly. When these structures do not exist or exist but cannot be used, we will instead restrict our attention to a subgraph of bounded tree-depth. We begin with the lemma that the problem is fixed-parameter tractable when parameterized by tree-depth instead of path length.
3.1 Tree-depth
Our method for graphs of low tree-depth is based on the fact that, when these graphs are large, they contain a large amount of redundant structure: subgraphs that are all connected to the rest of the graph in the same way as each other. When this happens, we can eliminate some copies of the redundant structures and reduce the problem to a smaller instance size.
Definition 2
Given a graph and a vertex set , we define an -flap to be a subset of the vertices of such that is disjoint from and there are no edges from to . We say that two -flaps and are equivalent when the induced subgraphs and are isomorphic, by an isomorphism that reduces to the identity mapping on (Figure 3).
Observation 1
For any graph and any vertex set , a path of length can include vertices from at most -flaps of .
Proof
The path has vertices, and any two vertices in distinct flaps must be separated by at least one vertex of .
Lemma 1
Suppose we are given an instance of path reconfiguration for paths of length in a graph , and that contains a subset that is disjoint from the start and goal positions of the path and has more than pairwise equivalent -flaps , all disjoint from the start and goal. Then we can construct an equivalent and smaller instance by removing all but of these equivalent -flaps.
Proof
Any reconfiguration sequence in the original graph can be transformed into a reconfiguration sequence for the reduced graph by using one of the remaining -flaps whenever the sequence for the original graph enters an -flap. Because the -flaps are equivalent, the moves within the flap can be mapped to each other by the isomorphism defining their equivalence, and by Observation 1 there will always be a free -flap to use in the reduced graph.
Lemma 2
We can solve the decision or optimization problems for path reconfiguration in time that is fixed-parameter tractable in the tree-depth of the input graph.
Proof
We provide a polynomial-time kernelization algorithm that uses 1 to reduce the instance to an equivalent instance whose size is a function only of the given tree-depth . The problem can then be solved by a brute-force search on the resulting smaller instance. We assume without loss of generality that we already have a tree decomposition of depth , as it is fixed-parameter tractable to find such a decomposition when one is not already given [15, p. 138]. Recall that, for graphs of tree-depth , the length of the paths being reconfigured can be at most .
We apply 1 in a sequence of stages so that, after stage , all vertices at height in have children. As a base case, for stage 0, all vertices at height 0 in automatically have 0 children, because they are the leaves of . Therefore, suppose by induction on that all vertices at height less than in have children.
For a given vertex at height , let be the set of ancestors of in (including itself). Then, for each child of in , let be the set of descendants of (including itself). Then is an -flap, because includes all of its ancestors in and it can have no edges to vertices that are not ancestors in . If we label each vertex in by the set of heights of its adjacent ancestors, then the isomorphism type of is determined by these labels, so two children and of have equivalent -flaps whenever they correspond to isomorphic labeled subtrees of . Trees of constant size with a constant number of label values can have a constant number of isomorphism types, so there are a constant number of equivalence classes of flaps among the sets . Within each equivalence class, we apply 1 to reduce the number of flaps within that equivalence class to a constant. After doing so, we have caused the vertices of at height to have a constant number of children, completing the induction proof.
To implement this method in polynomial time, we can use any polynomial time algorithm for isomorphism of labeled trees [11]. The equivalence of subtrees of by labeled isomorphism may be finer than the equivalence of the corresponding subgraphs of by graph isomorphism (because two different labeled trees may correspond to isomorphic subgraphs) but using the finer equivalence relation nevertheless leaves us with a kernel of size depending only on . The time for this algorithm can be bounded by a polynomial, independent of the parameter.
As the following observation shows, this result is nontrivial in the sense that its time bound is significantly smaller than the worst-case bound on the size of the state space for the problem.
Observation 2
In graphs of tree-depth , the number of paths of a given length can be .
Proof
Let be a tree realizing the depth of the given graph. To prove that the number of paths is , consider the vertex in any path that is highest in tree , and apply the same bound inductively for the two parts of the path on either side of , both of which must live in lower-depth subtrees. The total number of paths can be at most the product of the numbers of choices for these two smaller paths.
To prove that the number of paths can be , let be a star as the base case for depth one (with paths of length two) and at each higher depth connect two inductively-constructed subtrees through a new root vertex . Given a tree constructed in this way, let be the graph of all ancestor-descendant pairs in (Figure 4). Each two paths in the two subtrees can be connected to each other through , so the number of paths in the whole graph is the product of the numbers of paths in the two subtrees.
Therefore, an algorithm that searched the entire state space would only be in , not .
3.2 Loose paths
We have seen that graphs without long paths are easy for path reconfiguration. Next, we show that graphs with long paths are also easy. The following definition is central to this part of our results:
Definition 3
Consider an instance of path reconfiguration consisting of a graph , a start path of length , and a goal path of length . We define a loose path to be a simple path of length in , such that is vertex-disjoint from both and (Figure 5).
Lemma 3
Let be a loose path for an instance of path reconfiguration, such that it is possible to reconfigure path into a path that uses at least one vertex of . Then for every vertex in , it is possible to reconfigure path into a sub-path of for which is an endpoint.
Proof
Consider a sequence of reconfiguration steps starting from that results in a path using at least one vertex of and is as short as possible. Because is as short as possible and is disjoint from , the last move of must cause exactly one vertex of to be an endpoint of the reconfigured path. Because has length , at least one endpoint of is at distance or more along from . By sliding the path along towards this endpoint, we can reconfigure it so that it lies entirely along . Again, because has length , one of the two sub-paths of ending at has length at least . By concatenating to an additional sequence of steps that slide the path along (if necessary) we can reconfigure the starting path so that it lies within this sub-path and ends at .
We call a loose path that meets the conditions of 3 a reachable loose path.
Lemma 4
If an instance of path reconfiguration has a reachable loose path, and the graph is connected, then all loose paths for that instance are reachable.
Proof
Let be a reachable loose path, and be any other loose path. If and share a vertex , then it is possible to slide any sub-path of so that it includes this vertex, showing that meets the conditions of 3. If and are disjoint, let be a shortest path between them in , and let be the unique vertex of that belongs to . By 3, we can reconfigure the starting path so that it lies along and ends at . From there, we can slide the path along until it reaches the other endpoint of , a vertex of . This shows that meets the conditions of 3.
It will be helpful to bound the tree-depth of graphs with no loose path.
Observation 3
If an instance of path reconfiguration for paths of length has no loose path, then its graph has tree-depth less than .
Proof
Form a depth-first-search forest of the subgraph formed by removing all vertices of the start and goal paths. Because there is no loose path, has depth at most . Form a single rooted path of the vertices of the start and goal paths, in an arbitrary order. Connect and into a single tree (not necessarily a subtree of the input graph) by making each root of be a child of the leaf node of . Then every edge in the given graph connects an ancestor–descendant pair in , because either it connects two vertices in the depth-first-search forest or it has at least one endpoint on the ancestral path . Thus, meets the condition for trees realizing the tree-depth of a graph, and its depth is at most , so the given graph has tree-depth at most .
3.3 Win-win
We show now that we can either restrict our attention to a subgraph of bounded tree-depth or find a reachable loose path, in either case giving a structure that allows us to solve path reconfiguration.
Definition 4
Given an instance of path reconfiguration, we say that is a reachable set of vertices if, for every vertex in , there exists a sequence of reconfiguration steps that takes into a path that uses vertex . We say that is an inescapable set of vertices if, for every vertex that is not in , there does not exist a sequence of reconfiguration steps that takes into a path that uses vertex .
Lemma 5
Given an instance of path reconfiguration, parameterized by the length of the start and goal paths, we can in fixed-parameter-tractable time find either a reachable loose path, or a reachable and inescapable set of vertices that induces a subgraph of tree-depth at most .
Proof
We will maintain a vertex set that is reachable and induces a subgraph of tree-depth less than until either finding reachable loose path or finding that is inescapable and has no path. Initially, will consist of all vertices of the start path ; clearly, this satisfies the invariants that is reachable and has tree-depth less than .
Then, while we have not terminated the algorithm, we perform the following steps:
- •
For each edge where and , use the algorithm of 2 to test whether can be reconfigured within (a graph of tree-depth at most ) into a path that uses vertex . If we find any single edge for which this test succeeds, we go on to the next step. Otherwise, if no edge passes this test, is inescapable and we terminate the algorithm.
- •
Test whether the graph contains a loose path. Finding a path of fixed length is fixed-parameter tractable for arbitrary graphs [2, 6, 1] and can be solved even more easily by standard dynamic programming techniques for graphs of bounded tree-depth. If this test succeeds, the loose path must contain , as the remaining vertices have no loose path. In this case, we have found a reachable loose path (as is reachable) and we terminate the algorithm.
- •
Add to and continue with the next iteration of the algorithm. Because (in this case) is reachable but contains no loose path, it follows that including in maintains the invariants that be reachable and induce a subgraph with tree-depth at most .
Because each iteration adds a vertex to , the loop must eventually terminate, either with a reachable inescapable subgraph of low tree-depth (from the first step) or with a reachable loose path (from the second step).
3.4 Fixed-parameter tractability
We are now ready to prove our main result:
Theorem 3.1
The path reconfiguration decision problem is fixed-parameter tractable when parameterized by the length of the start and goal paths.
Proof
Our algorithm for path reconfiguration begins by applying 5 to find either a reachable inescapable subgraph of low tree-depth or a reachable loose path. If we find a reachable inescapable subgraph that does not include all the goal path vertices, the reconfiguration problem has no solution. If we find a reachable inescapable subgraph that does include all the goal path vertices, we can solve the reconfiguration problem by applying 2.
If we find a reachable loose path for the given instance , we apply 5 a second time, to the equivalent reversed instance . If we find a reachable inescapable subgraph that does not include all the vertices of the original start path , the reconfiguration problem has no solution. If we find a reachable inescapable subgraph that does include all the vertices of , we can solve the reconfiguration problem by applying 2.
If we find a second reachable loose path , one that (by time-reversal symmetry) can reach the goal configuration, then the original reconfiguration problem has a positive solution. For, in this case, we can reconfigure to a path that lies along , then (by 4) to a path that lies along , then (by the reverse of the reconfiguration sequence found by the second instance of 5) to .
We leave as open the question of whether a similar result can be obtained for the optimization problem.
4 Tree-like graphs
In this section we show that several special classes of graphs have polynomial algorithms for path reconfiguration regardless of path length. The prototypical example are the trees, for which the existence of a polynomial time algorithm follows immediately from the fact that any -vertex tree has distinct paths. In Section 5, we refine this idea and provide a linear time algorithm for path reconfiguration in trees. In this section, we consider more general classes of graphs. For simplicity of exposition, rather than attempting to optimize the exponents of our algorithms (as we do for trees), we limit our work in this direction to determining which classes of graphs have polynomial-time or fixed-parameter tractable algorithms.
4.1 Circuit rank
The circuit rank of an undirected graph is the minimum number such that may be decomposed into the edge-disjoint union of a forest and an -edge graph . If is connected, with edges and vertices, then we have the simple formula . The forest may be chosen as any spanning forest of ; the remaining set of edges in will automatically have .
Lemma 6
Let be a connected graph formed as the edge-disjoint union of a forest and another graph . Then the paths in are uniquely determined by their pairs of endpoints and by the intersection of their edge sets with .
Proof
Suppose for a contradiction that there existed two distinct paths and with the same two endpoints and the same intersections with . Then the symmetric difference of their edge sets, , would be a non-empty subgraph of with even degree at every vertex, contradicting the assumption that is a forest.
Corollary 1
In an -vertex graph with circuit rank , there can be at most distinct paths.
Corollary 2
Path reconfiguration (in both the decision and optimization problems) can be solved by breadth-first search of the state space in time that is fixed-parameter tractable in the circuit rank.
4.2 Feedback vertex set
A feedback vertex set in a graph is a subset of vertices the removal of which would leave a forest. The feedback vertex set number of is the minimum size of a feedback vertex set. (Analogously, the circuit rank can be thought of as the feedback edge set number.)
Lemma 7
In an -vertex graph with feedback vertex set number , the number of paths is at most
[TABLE]
Proof
A path can be completely specified by which vertices of the feedback vertex set are present, in what order these vertices are present along the path, and what path in the remaining forest (if any) is used before the first feedback vertex set vertex, after the last feedback vertex set vertex, and between each two feedback vertex set vertices. There are choices for which vertices of the feedback vertex set are present, at most choices for how they are ordered, choices for either a path in the forest, a single vertex in the forest, or a direct connection between two feedback vertex set vertices, and at most paths in the forest (or direct connections) that must be chosen.
Corollary 3
Path reconfiguration (in both the decision and optimization problems) can be solved by breadth-first search of the state space in time that is polynomial whenever the feedback vertex set number is bounded by a constant.
Because its exponent depends on , the resulting parameterized algorithm does not belong to the complexity class of fixed-parameter tractable algorithms, but rather to the class of algorithms that are polynomial for constant parameter values but with an exponent depending on the parameter.
4.3 Other tree-like graph classes
It is natural to consider whether path reconfiguration might be solved more easily for some other classes of graphs that have a tree-like structure but whose circuit rank and feedback vertex set number may be unbounded. These include, for instance, the cactus graphs (graphs for which each biconnected component is either a single edge or a simple cycle) and the block graphs (graphs for which each biconnected component is a complete subgraph). We leave as open for future research the questions of whether path reconfiguration can be solved efficiently in these graphs.
Solving the path reconfiguration problem for the block graphs would also necessarily involve solving it for the complete graphs. The path reconfiguration decision problem is trivial for complete graphs: if the paths have fewer than vertices, the answer is always yes, and if they have exactly vertices then the answer is yes if and only if one path is a cyclic shift or the reversal of a cyclic shift of the other. However, even for complete graphs the path reconfiguration optimization problem appears to be nontrivial.
5 In trees
In this section we provide a linear time algorithm for the path reconfiguration optimization problem in trees. The input is a tree , a starting path and an ending path that we wish to reconfigure to. Our strategy is to identify intermediate positions , such that can be reconfigured to , can be reconfigured to , and , are in critical position meaning that is contained in a path in —which makes it trivial to reconfigure to . See Figure 7 and Figure 9. We will show that the possible critical positions can be explored efficiently. To reconfigure to a critical position we will give a reduction to a subproblem that we call sub-path reconfiguration. We first show how to solve sub-path configuration and then how to reduce the general problem to subpath reconfiguration.
5.1 Sub-path reconfiguration
Definition 5
Sub-path reconfiguration is a problem in which we are given a tree , a path in , and a sub-path of from one given vertex to another given vertex . We use the notation to denote this sub-path reconfiguration problem. The object of the problem is to reconfigure (via the same steps as in the path reconfiguration problem) within to any other path that has an endpoint at and contains the same sub-path from to , and such that each intermediate path of the reconfiguration process also contains the sub-path from to . As with path reconfiguration we define two variants of this problem, the decision problem in which the goal is to decide if such a reconfiguration exists and the optimization problem in which the goal is to find the shortest possible reconfiguration.
We will reduce sub-path reconfiguration to “simpler” instances of the same problem, where “simpler” means that the subpath becomes larger.
Definition 6
Let be a sub-path reconfiguration problem. We define a suitable detour vertex to be a vertex in that is not internal to the subpath from to and such that there exists a suitable detour path of length in that starts at and coincides with from to . We define the first suitable detour vertex to be the suitable detour vertex farthest from (and therefore closest to the end of ), and we define a first suitable detour path to be a suitable detour path for . See Figure 6(b).
Reduction for subpath reconfiguration:
- •
Find , the first suitable detour vertex. If does not exist then declare failure, and otherwise let be a first suitable detour path.
- •
Let be the neighbour of in that is farthest from . Solve the subpath reconfiguration problem . Let be a shortest solution, and suppose it reconfigures to . See Figure 6(b).
- •
Observe that and overlap on the subpath from to and that their union is a simple path. Let be the reconfiguration sequence of length that slides to .
- •
Return the concatenation .
We will show how to find and in the following subsection. Note that in case there are multiple choices for the first suitable detour path , all choices give the same length reconfiguration sequence.
Lemma 8
The above algorithm finds a shortest reconfiguration sequence for the subpath reconfiguration problem .
Proof
Consider a shortest reconfiguration sequence that solves , and let be the final path at the end of . Let be the maximal subpath shared by and and suppose that goes from to . Note that includes . Let be the neighbour of in that is outside —note that exists otherwise . See Figure 6(c). Initially, contains both edges and . Consider the first time during when one of these edges leaves . It cannot be , otherwise we would have solved the subpath reconfiguration before reaching . Therefore there must be some shortest prefix of that reconfigures to a path that ends at and includes . Furthermore, all edges of are included throughout . Then and are in critical position sharing the subpath . can be reconfigured to by sliding it along for steps, and there is no shorter reconfiguration because the paths lie in a tree. Thus .
We now compare what the algorithm does. Because is a suitable detour vertex for , we know that a first suitable detour vertex, , exists, and that is at least as far from as . As in the algorithm, let be the subpath from to . Then lies in and . The algorithm finds a shortest solution to the subpath reconfiguration problem . We claim that . This is because must move the endpoint of to before it can reach . The solution returned by the algorithm has length . Thus the algorithm finds a shortest reconfiguration sequence.
5.2 Sub-path reconfiguration algorithm
To solve sub-path reconfiguration quickly, we need to be able to quickly identify the first suitable detour vertex for a given sub-path reconfiguration problem. And we need to find a first suitable detour path.
We can assume without loss of generality that the initial path we are given consists of the vertices in order. We say that is the left endpoint of and that is the right endpoint. Based on this orientation of , we can define two quantities and at each vertex , as follows:
- •
Let be , where is the length of the longest path in that ends at and does not use vertex . That is, measures how much deeper than a path from can go. If we root at , then is just the height (maximum distance from a leaf) of , so all values can be computed in linear time by a simple bottom-up calculation on this rooted tree.
- •
Let be , where is the length of the longest path in that ends at and does not use vertex . That is, measures how much deeper than a path from can go. If we root at , then is just the height of , so all values can be computed in linear time by a simple bottom-up calculation on this rooted tree.
Observation 4
For a subpath reconfiguration problem with , is a suitable detour vertex if and only if and . For a subpath reconfiguration problem with , is a suitable detour vertex if and only if and .
Lemma 9
For a subpath reconfiguration problem , we can find the first suitable detour vertex (if it exists) in time .
Proof
We test the sequence of vertices (if ) or the sequence (if ), using Observation 4 to check in constant time whether each vertex in the sequence is a suitable detour vertex, until either reaching the end of path or finding a vertex that is not a suitable detour. If is not itself a suitable detour vertex, then no suitable detour exists. If we reach the end of the sequence, then the last vertex that was tested (the vertex at the end of the sequence) is the first suitable detour vertex. If we find a vertex other than that is not a suitable detour vertex, then the previous vertex in the sequence is the first suitable detour vertex.
Lemma 10
After linear-time preprocessing we can find a suitable detour path from the first suitable detour vertex, in time proportional to its length.
Proof
To preprocess the input, let be the forest formed from by removing the edges of . We root each tree of this forest at its unique vertex in (directing the edges of the forest away from ) and with a single bottom-up traversal of the tree we calculate for each vertex of two pieces of information: the length of the longest directed path starting at , and the identity of a child of that can be the neighbor of on one such longest path.
When we find a suitable detour vertex , the length of the corresponding detour path should be . We can find a path of this length, in time proportional to its length, by starting from and following a sequence of pointers to children on longest paths.
Lemma 11
We can solve the sub-path reconfiguration optimization problem in trees in linear time.
Proof
We repeatedly apply 9 and 10 to find the first suitable detour vertex and its detour path, and then 8 to reduce the problem to a sub-problem of the same type, until either reaching a sub-problem where is one of the endpoints of (in which case the solution is the empty reconfiguration sequence) or reaching a sub-problem with no suitable detours (in which case there is no reconfiguration sequence).
Each reduction includes at least one new vertex in the sub-path between the two vertices defining the reduced sub-problem, so the total number of levels of reduction is at most . The time for each reduction step is proportional to a constant, plus the length of the sub-path from to (according to the notation of 9), plus the length of the detour path. The sub-paths are all edge-disjoint, as each one is outside the path between the two endpoints of the sub-path reconfiguration problem before the reduction, and inside this path after the reduction. Therefore their total length, and the total time for finding the whole sequence of reductions, adds to .
The detour paths are all disjoint, so their total length, and the time for finding them, adds to . The subsequences concatenated in each reduction step each involve sliding along one of these detour paths, and each edge of such a path contributes two units to the total length of these subsequences (one unit for the step in which the path first enters that edge, and a second unit for the step in which it leaves the edge again). Therefore, the total length of all these subsequences is and even if we write them out explicitly (as a single piece of information per step, the identity of the edge that the path slides into) the total time for doing so is ).
5.3 Reducing path reconfiguration to sub-path reconfiguration
Consider a path reconfiguration problem for starting path and ending path in tree . We will separate into two cases depending on whether and are edge-disjoint or not.
5.3.1 Edge-disjoint paths
We begin with an algorithm to reduce path reconfiguration to sub-path reconfiguration in the case where the and are edge-disjoint, as illustrated in Figure 7(a). Let be the (unique) path in from to , connecting vertices and . It is possible that and has no edges. The idea of our solution is to find a critical position , where ends at and ends at .
Reduction for edge-disjoint paths:
- •
For each a neighbor of in , solve the sub-path reconfiguration optimization problem . If there are no solutions, then declare failure, and otherwise, let be a shortest solution, and suppose it reconfigures to .
- •
For each a neighbor of in , solve the sub-path reconfiguration optimization problem . If there is no solution, then declare failure, and otherwise, let be the time-reversal of a shortest solution, and suppose it reconfigures to .
- •
Observe that is a simple path, so the paths , are in critical position. Let be the reconfiguration sequence of length that slides along the path to .
- •
Return the concatenation .
This construction is illustrated in general in Figure 7 and for a specific example in Figure 8.
Lemma 12
The above algorithm finds a shortest reconfiguration sequence for when and are edge disjoint. Furthermore, the algorithm solves at most four subpath reconfiguration problems.
Proof
We first show that any shortest reconfiguration sequence, , from to necessarily has an intermediate critical position where ends at and ends at . If is an endpoint of then is already in critical position. Otherwise, let the two neighbors of in be and . The original path uses both edges and , and this remains true during until the reconfigured path ends at . Since uses neither of these edges, there must be some shortest prefix of that reconfigures to a path, that ends at and uses exactly one of these two edges. (Note: is empty if the initial ends at .) By an argument that is symmetric under time-reversal symmetry, there must be some shortest suffix of that reconfigures a path, to , where ends at and uses exactly one of its two incident edges in . Observe that and are edge-disjoint and that neither shares an edge with . Furthermore, the prefix and suffix are disjoint, because any step that is intermediate to both of them would correspond to a path in that uses both edges of incident to and both edges of incident to , but no such path can exist. Thus and form a critical position.
can be reconfigured to by sliding it along for steps, and there is no shorter reconfiguration because the paths lie in a tree.
We now examine how solves the critical position. Let be the subsequence of that reconfigures to , so that is the concatenation . Note that is a simple path of length . By sliding along this path, we can reconfigure to in steps. Furthermore, because the graph is a tree, there is no shorter reconfiguration sequence from to . Thus .
We now compare what the algorithm does. Suppose that uses the edge and uses the edge . The algorithm tries vertex and finds an optimum solution to the subpath reconfiguration problem . Since is one possible solution, thus . Similarly, the algorithm tries vertex and finds an optimum solution to the subpath reconfiguration problem . Since the time reversal of is one possible solution, thus . Furthermore, and have the same length . Therefore the algorithm finds a shortest reconfiguration sequence.
5.3.2 Overlapping paths
We now consider path reconfiguration where the paths and share at least one edge. In particular, suppose they share a maximal subpath from vertex to vertex . We will show that any shortest reconfiguration sequence involves a critical position of one of the following forms (see Figure 9):
and are edge-disjoint, and they both end at or they both end at . 2. 2.
and share a non-empty prefix or suffix of .
We will try all these types of critical positions to see which gives a shortest solution.
Notation: Let be the neighbour of in but not in , if it exists, and let be the neighbour of in but not in , if it exists. Similarly, let be the neighbour of in but not in and let be the neighbour of in but not in if they exist. Let be the neighbour of in and let be the neighbour of in . See Figure 9(a).
Reduction for paths that share edges:
Try all four of the following options and return one that gives the shortest reconfiguration sequence:
, share only vertex . See Figure 9(b).
- •
Solve the sub-path reconfiguration problem . If there is no solution or does not exist, then abandon this case, and otherwise, let be a shortest solution, and suppose it reconfigures to .
- •
Solve the sub-path reconfiguration problem . If there is no solution of does not exist, then abandon this case, and otherwise, let be the time-reversal of a shortest solution, and suppose it reconfigures to .
- •
Let be the reconfiguration sequence of length that slides to .
- •
Add to the set of candidate solutions. 2. 2.
, share only vertex . This is symmetric to option 1 and is solved similarly. 3. 3.
, share a prefix of . See Figure 9(c).
- •
Solve the sub-path reconfiguration problem . If there is no solution, then abandon this case, and otherwise, let be the first suitable detour, let be a shortest solution, and suppose it reconfigures to .
- •
If is not in the subpath then replace by . Solve the sub-path reconfiguration problem . If there is no solution, then abandon this case, and otherwise, let be the time-reversal of a shortest solution, and suppose it reconfigures to .
- •
Let be the prefix of from to . Note that and are in critical position, sharing . Let be the reconfiguration sequence of length that slides to .
- •
Add to the set of candidate solutions. 4. 4.
, share a suffix of . This is symmetric to option 3 and is solved similarly:
- •
Solve the sub-path reconfiguration problem . If there is no solution, then abandon this case, and otherwise, let be the first suitable detour, let be a shortest solution, and suppose it reconfigures to .
- •
If is not in the subpath then replace by . Solve the sub-path reconfiguration problem . If there is no solution, then abandon this case, and otherwise, let be the time-reversal of a shortest solution, and suppose it reconfigures to .
- •
Let be the suffix of from to . Note that and are in critical position, sharing . Let be the reconfiguration sequence of length that slides to .
- •
Add to the set of candidate solutions.
Specific examples are illustrated in Figure 10, Figure 11, and Figure 12.
Lemma 13
The above algorithm finds a shortest reconfiguration sequence for when and share at least one edge. Furthermore, the algorithm solves at most eight subpath reconfiguration problems.
Proof
The algorithm tries four options, each solving at most two subpath reconfiguration problems, which proves the “furthermore” statement.
We will show that any shortest reconfiguration sequence, , from to , necessarily has an intermediate critical position of one of the above types, and then argue that the algorithm finds a shortest solution.
We use notation as defined at the beginning of the algorithm. Since uses neither of the edges nor , there must be some shortest prefix of that reconfigures to a path that does not use both these edges. (It is possible that .) It suffices to consider the case where does not use —the other case is obtained by exchanging the roles of and . (And note that the algorithm treats and equally.) Then must exist, and must have one endpoint at and must include all the edges of . Furthermore, all the edges of are included throughout . See the first frames of Figure 13.
We now apply the same argument to the time-reversal of the reconfiguration sequence . Let be the neighbour of in but not in , and let be the neighbour of in but not in , if these vertices exist. Then there must be some shortest suffix of that reconfigures a path, to , where either: ends at and includes all the edges of ; or ends at and includes all the edges of . In both cases, the included edges are in the path throughout . We deal with these cases separately.
Case 1. ends at and includes all the edges of . Then and are in critical position and overlap on . We claim that the subsequence, of that reconfigures to does so in steps by sliding along to . As before, the argument is that sliding is feasible, and there is no shorter solution because the graph is a tree.
Next we show that, in this case, the algorithm finds a reconfiguration sequence of length . In option 4, the algorithm solves the subpath reconfiguration problem . Since is a possible solution, the algorithm finds a reconfiguration sequence of length at most . Furthermore, includes all the edges of , so the first suitable detour vertex for lies outside . Thus, the algorithm next resets to and solves the subpath reconfiguration problem . The time-reversal of is a possible solution, so the algorithm finds a reconfiguration sequence of length at most . Finally, the algorithm finds , a slide of length . In total the algorithm finds a reconfiguration sequence of length at most . Since was shortest, the algorithm finds a minimum length sequence.
Case 2. ends at and includes all the edges of . See Figure 13. Consider what happens in after . So long as the path uses both and , it cannot be reconfigured to . Therefore, there must be some first time after where the path gets reconfigured to a path that has an endpoint at and uses exactly one of the two edges or . Applying the same argument to the time-reversed sequence, there must be some last time before where the path has an endpoint at and uses exactly one of the two edges or . Observe that does not occur after in , although they may be equal. We consider 4 subcases.
Case (i). uses the edge and uses the edge . Then and are in critical position, edge-disjoint, and sharing vertex . The algorithm finds this solution in option 1. (The details of correctness are as in the proof of 12.)
Case (ii). uses the edge and uses the edge . Then in the step before the path—let’s call it —ends at and uses and so and are in critical position (overlapping on ) so we could shortcut by reconfiguring to , a contradiction to being shortest.
Case (iii). uses the edge and uses the edge . This is ruled out by symmetry with the previous case.
Case (iv). and both use the edge . Let be the prefix of that reconfigures to and let be the suffix of that reconfigures to .
In option 3, the algorithm solves the subpath reconfiguration problem , with first suitable detour vertex , reconfiguration sequence , and first suitable detour path . Since is a possible solution to , the algorithm finds a reconfiguration sequence of length at most .
Consider an alternate algorithm that next solves the subpath reconfiguration problem . Let be the time-reversal of a shortest solution. We first claim that reconfigures to . This is because the first suitable detour vertex is defined the same way for both and , and furthermore, we can use the same first suitable detour path for (as noted after the subpath reconfiguration reduction).
We next show that is a shortest reconfiguration sequence from to . We already noted that . Similarly, the time-reversal of is a possible solution to so . Thus . Since is a shortest reconfiguration sequence, therefore the alternate algorithm finds an optimum solution.
Finally, we will show that the alternate algorithm and option 3 of the actual algorithm give the same length reconfiguration sequence. In the alternate algorithm, is the time-reversal of a shortest solution to . By 8 where is the time-reversal of a shortest solution to and slides to the path resulting from (these two paths overlap from to ). Option 3 of the algorithm finds a solution where is the time reversal of a shortest solution to —which is the same subproblem solved in the alternate algorithm—and slides to the resulting path, which overlaps from to . Therefore and , which implies that . Thus the alternate algorithm and the actual algorithm produce reconfiguration sequences of the same length. This completes the proof that the algorithm finds a shortest reconfiguration sequence from to .
5.4 Overall algorithm
Summarizing the results of this section, we have:
Theorem 5.1
We can solve the path reconfiguration optimization problem in trees in linear time.
Proof
We apply 12 for edge-disjoint paths and 13 for overlapping paths to reduce the problem to the solution of a constant number of sub-path reconfiguration optimization problems, and 11 to solve each of these sub-path reconfiguration problems in linear time.
6 Hardness
In this section we describe a reduction from nondeterministic constraint logic showing that path reconfiguration (with unbounded path length) is -complete even on graphs of bounded bandwidth. This result rules out the possibility (unless ) that our results on tree-like graph classes from Section 4 can be extended to another tree-like class of graphs, the graphs of bounded treewidth. An example of our reduction is depicted in Figure 14.
6.1 Nondeterministic constraint logic
For our hardness results, we will use nondeterministic constraint logic, a reconfiguration problem on orientations of weighted undirected cubic graphs introduced by Demaine and Hearne [9, 10] as a fundamental hard problem for proving the hardness of a wide variety of games and puzzles.
An instance of nondeterministic constraint logic is determined by an undirected graph with exactly three edges per vertex. The edges have weight either one or two, and the total weight at each vertex is required to be even. A valid orientation of this graph is an assignment of a direction to each edge so that the total incoming weight at each vertex is at least two. For the type of reconfiguration problem that we study here, we are interested in whether it is possible to get from a given starting orientation to a given goal orientation (both valid) by moves that reverse the direction of a single edge and preserve the validity of the orientation. This problem is known to be -complete, even when restricted to graphs of bounded bandwidth [16].
By convention, when visualizing instances of nondeterministic constraint logic, the edges of weight one are drawn as red and the edges of weight two are drawn as blue. There are two types of vertex: AND gates with two red edges and one blue edge, and OR gates with three blue edges. For an AND gate, the blue edge can only be oriented outwards if both red edges are oriented inwards. For an OR gate, any one of the blue edges can be oriented outwards as long as at least one of the other two blue edges is oriented inwards.
6.2 Gadgets
Recall that the constraint graph of a nondeterministic constraint logic instance has edges of two types (blue and red), each of which can be oriented in either direction as the instance is reconfigured, and vertices of two types (AND vertices, with two red edges and one blue edge, and OR vertices, with three blue edges) which require at each step that at least one blue edge or two red edges be oriented inwards. The instances of path reconfiguration created by our reduction will have subgraphs (“gadgets”) corresponding to these constraint graph features: edge gadgets corresponding to the edges of the constraint graph (depicted as the blue and red regions of Figure 14) and vertex gadgets corresponding to the vertices of the constraint graph (the yellow regions of Figure 14). The edge gadgets will not be differentiated by color (the red and blue edges of the constraint graph generate edge gadgets of the same type) but we will have two different types of vertex gadgets for the two different types of constraint graph vertex. In addition we will also have a third type of gadget, connection gadgets, depicted as green in Figure 14. The edge gadgets of the reduction will be organized into a single cyclic sequence (not necessarily related to the connectivity of the constraint graph) and each pair of consecutive edge gadgets in this cyclic sequence will be connected to each other by a connection gadget.
In more detail:
- •
Each vertex gadget has three pairs of entrance and exit vertices (one pair of an entrance and exit vertex for each incident edge gadget) and one or two other interior vertices.
- •
The vertex gadgets for OR vertices of the constraint graph (the three on the left side of Figure 14) have two interior vertices, with each entrance or exit vertex connected to each interior vertex to form a complete bipartite subgraph.
- •
The vertex gadgets for AND vertices of the constraint graph (the three on the right side of Figure 14) form a tree with six edges. Two of these edges form a path connecting the blue entrance and exit vertices to each other through the single interior vertex. Two more edges connect one pair of a red entrance and exit vertex to each other through the blue entrance vertex, and the final two edges connect the other pair of a red entrance and exit vertex to each other through the blue exit vertex.
- •
Each edge gadget consists of two disjoint paths. One of these two paths connects the two entrance vertices of the two adjacent vertex gadgets and the other connects the two exit vertices of the same two gadgets. Both paths must have equal, even length, but we do not require that these lengths be uniform across all edge gadgets. (In Figure 14, all edge gadget paths have length 2.)
- •
Each connector gadget consists of a single path, from the midpoint of the exit path of one edge gadget to the midpoint of the entrance path of another edge gadget. All paths must have length that is at least as large as a threshold length to be determined later, but they are not required to have uniform lengths. (In Figure 14, all connector gadget paths have length 3.)
6.3 Valid paths
Along with its underlying undirected graph, an instance of nondeterministic constraint logic also comes equipped with two orientations of the graph (consistent with its constraints): an initial orientation and a final orientation. The corresponding objects in our reduction to path reconfiguration will be paths of a certain special form, which we call valid paths.
It is convenient to start by defining a valid cycle instead of a valid path. A valid cycle is a cycle in the path graph that meets the following constraints:
- •
uses all the edges of all the connector gadgets.
- •
Within each edge gadget, uses half of the entrance path, from the midpoint (where it is reached by a connector gadget) to the entrance vertex of one of its two incident vertex gadgets, and then half of the exit path, from the exit vertex of the same vertex gadget to the midpoint of the exit path (where it reaches another connector gadget).
- •
Within each vertex gadget , for each incident edge gadget such that follows the paths in from the midpoints to the entrance and exit of , connects the entrance and exit vertices for by a path of length two.
All valid cycles have the same length. We define a valid path to be a path that can be formed by removing a single edge from a valid cycle. For instance, the path of heavy black edges in Figure 14 is a valid path.
Observation 5
Every valid path has a unique completion to a valid cycle.
We now define a mapping from valid cycles (or equivalently by Observation 5, valid paths) to consistent orientations of the underlying constraint graph. The orientation is determined, for each edge of the constraint graph, by the following simple rule: orient away from the vertex through which the edge gadget for is connected.
Lemma 14
If is a valid cycle, is a consistent orientations of the underlying constraint graph.
Proof
In an OR vertex gadget, the only two-edge paths from an entrance to an exit vertex go through one of the interior vertices. There are only two such interior vertices, so there can be only two such paths in , and two edges oriented away from the vertex in . Therefore, at least one of the three incident edges must be oriented inwards, meeting the requirements for a consistent orientation at that vertex.
In an AND vertex gadget, the unique two-edge paths from a red entrance vertex to the corresponding red exit vertex pass through an entrance or exit for the blue vertex. Therefore, if either of these paths is used by (corresponding to a red edge being oriented outwards in ), the blue two-edge path cannot also be used, and the blue edge must be oriented inwards in . Thus, meets the requirements for a consistent orientation at that vertex.
Lemma 15
The mapping is a surjective mapping from valid cycles (or equivalently by Observation 5, valid paths) to consistent orientations of the underlying constraint graph.
Proof
By 14, every valid cycle corresponds to a consistent orientation so it remains to show that every consistent orientation arises in this way. That is, given a consistent orientation on the constraint graph, we must construct a valid cycle such that is that orientation. There is no choice for how passes through the connector gadgets (it must use all of them), nor through the edge gadgets (it must use the two half-paths on the side away from where the constraint graph edge is directed), so the only remaining part of to construct is its two-edge paths through each vertex gadget.
In a vertex gadget for an OR vertex of the constraint graph, the consistency of the orientation ensures that is required to connect at most two pairs of entrance and exit vertices. We can do so greedily, using one of the two interior vertices for a two-edge path for an arbitrarily chosen pair of entrance and exit vertices and then (if there is another pair of entrance and exit vertices to be connected) doing so through the other interior vertex.
In a vertex gadget for an AND vertex of the constraint graph, there is a unique choice of two-edge path for each pair of an entrance and exit vertex that must be connected. These paths are disjoint unless there is both an outgoing blue edge and an outgoing red edge, which cannot happen in a consistent orientation of the constraint graph.
We note, however, that even when considering valid cycles rather than valid paths, is not injective: the same consistent orientation on the constraint graph may be represented by more than one valid cycle. This failure of injectivity will cause complications in our reduction which we handle in Section 6.5.
6.4 Reconfiguration
We define a valid reconfiguration move to be a sequence of path reconfiguration moves that take one valid path to another, according to the following steps:
- •
First, slide the path around its valid cycle, so that one of its endpoints is at the vertex where a connector gadget and an edge gadget meet.
- •
Then, slide the path along the edge gadget, away from the vertex gadget that it was previously connected through, so that it instead passes through a two-edge path in the opposite vertex gadget.
In Figure 14, the path is already at the vertex where a connector gadget and an edge gadget meet. However, it cannot reconnect through the opposite vertex gadget, because its two-edge path through that gadget is blocked by another part of the path. Therefore, in order to make a valid reconfiguration move in the figure, it would be necessary to first slide the path to end at a different edge gadget.
Lemma 16
If is a valid path, then every valid reconfiguration move corresponds to a consistent reorientation of a single edge in and every consistent reorientation of a single edge in can be realized by a valid reconfiguration move.
Proof
It is straightforward to verify that a valid reconfiguration move changes the orientation of a single edge in The fact that this change of orientation is consistent with the constraints of the constraint graph follows immediately from 14.
If is a valid path, and is an edge that can be consistently reoriented in , then we may reorient by shifting along its corresponding valid cycle so that it ends at the edge gadget for and then following a path through the opposite vertex gadget than the one previously passed through. If this is the gadget for an AND vertex of the constraint graph, then its path is uniquely determined, and 15 ensures that it is free to be used by . If it is the gadget for an OR vertex, 15 ensures that at least one of the two interior vertices is available to be used by ; if both are available, we can choose which one to use arbitrarily.
Corollary 4
The mapping can be extended to a surjective map from reconfiguration sequences on the graph of the reduction to reconfiguration sequences on the underlying constraint graph.
Again, however, this map is not necessarily injective, an issue that we deal with in the next section.
6.5 OR-vertex parity
When a consistent orientation of the constraint graph has one or two outgoing edges at an OR vertex , the corresponding valid cycles in the graph of the reduction will use one or two two-edge paths through the vertex gadget for . If there is one two-edge path, it can use either of the two interior vertices of the vertex gadget. If there are two two-edge paths, they can be assigned to the interior vertices in either of two ways. Thus, in either case there are two choices for how the valid cycle passes through the vertex gadget. We refer to this choice as the parity of . Because of this freedom, for a consistent orientation in which there are OR vertices having one or two outgoing edges, there will be valid cycles corresponding to that orientation in the reduction graph.
It is not always the case that one of these valid cycles can be reconfigured into a different valid cycle that represents the same orientation of the constraint graph. Figure 15 depicts an example of this phenomenon. In the constraint graph shown, only the upper left and lower right diagonal red edges can be reoriented; the 10 remaining edges are all locked into the orientations shown in the figure. In particular, the two OR vertices of the figure are both locked in a configuration where they have two outgoing blue edges. In the corresponding valid cycles for the reduction graph, there are two choices for the parity of the corresponding vertex gadgets. It is not possible to change the parity by using valid reconfiguration moves, because such a move can only change one of the two-edge paths through the vertex gadget at a time, and both two-edge paths would need to be changed simultaneously.
To handle this issue, we choose valid paths for the initial and final orientations of the constraint graph instance with the property that, when the initial and final orientations are both locally the same at any given OR vertex, the corresponding valid paths have the same orientation at that vertex. In this way, if a reconfiguration sequence for the orientations of the constraint graph fails to make any reconfiguration moves at the given OR vertex, the corresponding valid reconfiguration sequence for paths in the reduction graph will never change the parity at that vertex, and will automatically produce a valid path with the correct parity. If, on the other hand, is an OR vertex of the constraint graph at which the reconfiguration sequence for the orientations of the constraint graph makes a change, then at least one of the orientations in the reconfiguration sequence will have at most one outgoing edge at . If a corresponding reconfiguration sequence for valid paths of the constraint graph produces the wrong parity at , it can be modified by inserting a sequence of moves that change the parity at a time when the valid path passes through at most once.
The sequence of moves that changes the parity at a vertex is not itself a valid reconfiguration move, because it does not reorient the corresponding constraint graph edge, but it is very similar. We slide the valid path along its valid cycle until it reaches the entrance of the outgoing edge at the corresponding vertex gadget, then slide it through the other choice of two-edge path through the vertex gadget. The change of parity is global: if we insert such a move anywhere that it can be performed within a valid reconfiguration sequence, it will change the parity at that vertex, and only at that vertex, in the valid path reached at the end of the sequence.
Summarizing, we have:
Lemma 17
Given an initial and final orientation of a constraint graph, it is possible to choose corresponding initial and final valid paths in the reduction graph such that there exists a reconfiguration sequence from the initial and final orientations if and only if there exists a sequence of valid reconfiguration moves and parity-change moves that take the initial path to the final path within the reduction graph.
6.6 Deviations from validity
Unfortunately, not every reconfiguration sequence, starting from a valid path in the reduction graph, consists only of valid reconfiguration moves and parity-change moves. A reconfiguration sequence can deviate from these moves in three ways.
First, it is possible to reverse a valid reconfiguration move or parity-change move. The reverse of a valid reconfiguration move shifts the valid path so that its endpoint is on the exit path (instead of the entrance) and then traverses backwards through an incident vertex gadget. These kinds of variant moves are harmless, because they have the same effect as performing the move in the forward direction.
Second, it is possible for the end of the current path to enter a vertex gadget at the entrance (or exit) vertex for one incident edge gadget , but then to exit the vertex gadget into a different edge gadget . However, if the connector gadgets are long enough, it will not be able to progress through to other parts of the reduction graph, because the midpoints of the two paths in will still be occupied by other parts of the path. Therefore, a reconfiguration sequence that makes this kind of variation cannot use it to reach another valid path; the only possible steps after being blocked in this way are to backtrack back through to the proper exit or entrance vertex for . A straightforward case analysis shows that, if all edge gadget paths have length at most , and all connector gadget paths have length at least , then this kind of variation will always be blocked. For instance, Figure 14 obeys these constraints with .
Third, and most problematically, in an OR vertex gadget with one outgoing edge (such as the upper left vertex gadget of Figure 14) it is possible for a reconfigured path to connect the entrance and exit vertices of its incident edge gadget by a path of length four instead of by the path of length two that would be required in a valid path. Although doing so would prevent reconfiguration of the other edge gadgets incident to that vertex gadget, it would also have the effect of increasing the length of the gap between the endpoints of the path as measured along the corresponding valid cycle. Potentially, if enough variant reconfigurations of this type could be performed, the gap could be made so large as to encompass multiple vertex gadgets, allowing simultaneous reconfiguration of multiple edges in the corresponding constraint graph. We do not know how to forbid these variant reconfigurations, but we can prevent them from having this harmful effect by making the connector gadget paths even longer, so that (even if some reconfigurations of this type occur) it is still impossible for the gap in the valid path to spread over more than one vertex gadget. In particular, with as above and denoting the number of OR vertex gadgets, we let (the minimum connector gadget length) be . With connector gadgets of length at least , even a gap of length between the endpoints of the path (along a corresponding valid cycle) would not be enough to allow a different valid cycle to be reached except via reorientations that could have been performed as valid reconfiguration moves.
Again, we summarize the results of this section in a lemma:
Lemma 18
If all connector gadgets have length at least , where denotes half of the maximum length of an edge gadget path and denotes the number of OR vertex gadgets, and if it is possible to reconfigure a valid path into a valid path , then it is possible to do so using only valid reconfiguration moves and parity-change moves.
6.7 Bandwidth
A linear layout of an -vertex graph is a labeling of its vertices with distinct integers in the range from 1 to . The width of a layout is the maximum difference between the labels of the two endpoints of any edge, and the bandwidth of the graph is the minimum width of any of its layouts. Although bandwidth is hard to compute, and hard to approximate even for some very simple graphs [5], this will not be problematic for us, as (from the previous hardness reduction for low-bandwidth nondeterministic constraint logic [16]) we can assume that the input to our reduction is a constraint graph with an already-given low-bandwidth layout. As we show in this section, there is enough remaining flexibility in our reduction (in its choice of path lengths and the ordering to connect the edge gadgets via the connector gadgets) that we can preserve the bounded bandwidth of its instances.
Lemma 19
The reduction described above can be implemented so that, for constraint graphs of bounded bandwidth with a given bounded-width layout, we can produce reduction graphs of bounded bandwidth.
Proof
We will assign non-integer numeric labels to the vertices of the reduction graph, allowing some vertices to have equal labels. We then perturb these labels to produce a total ordering of all the vertices, as follows.
To begin with, let be the number of vertices in the constraint graph. We set the length of all edge gadget paths to , and we set the length of all connector gadget paths to , meeting the requirements of 18. Let be the graph formed from the constraint graph by replacing each edge by a two-edge path; if has bounded bandwidth, so does , and we can construct a bounded-width linear layout of from the layout of . We label each vertex in a vertex gadget of the reduction graph by the integer label of the corresponding constraint graph vertex in . We label the midpoint of each edge gadget path by the integer label of the subdivision vertex on its corresponding two-edge path. We label the remaining interior vertices of the paths of each edge gadget in such a way that they are evenly spaced between the labels of the constraint graph vertex and subdivision vertex.
This labeling also gives us a total ordering of the midpoints of the edge gadget paths. We use this total ordering to choose how to connect the edge gadgets by a cycle of connector gadgets. This cycle will consist of two monotone paths, and , from the leftmost edge gadget midpoint to the rightmost edge gadget midpoint. Each edge gadget between the leftmost and rightmost is assigned to one of these two paths, so that the assignment alternates between and in the total ordering of edge gadget midpoints. We then connect each consecutive pair of edge gadgets in either or by a connector gadget. We label the interior vertices of each connector gadget in such a way that they are evenly spaced between the labels of the two incident edge gadget midpoints.
If the given graph has bounded bandwidth, then each edge gadget path or connector gadget path will have endpoints whose labels differ by a constant. Therefore, the difference between the labels of any two adjacent vertices within these gadgets is , and the difference between the labels of any two adjacent vertices within a vertex gadget is of course zero. However, for any interval of the real number line of length , our construction will assign only vertices of the reduction graph to have labels within . Therefore, if the labeling is arbitrarily perturbed to produce a total ordering, and the ranks in this total ordering are used as a linear layout of the reduction graph, the bandwidth of the resulting graph will be bounded.
6.8 Hardness
Combining the results above, we have:
Theorem 6.1
The path reconfiguration decision problem is -complete, even for graphs of bounded bandwidth.
Proof
Membership in is clear. To prove completeness, we reduce from nondeterministic constraint logic in graphs of bounded bandwidth, with a given low-bandwidth layout; this was previously known to be -complete [16]). The gadgets of the reduction are those given in Section 6.2, with the detailed choice of path lengths and connector gadget ordering of 19. The initial and final orientations of the given constraint graph are transformed into start and goal paths of a path reconfiguration problem according to 17.
It is straightforward to perform the reduction in polynomial time, and by 19, the bandwidth of the resulting reduction graph is bounded. If a solution exists to the given nondeterministic constraint logic problem, then one exists for the corresponding path reconfiguration problem by 17. If no solution exists for the constraint logic problem, then correspondingly no solution exists for the path reconfiguration problem by 18 and 4.
The reference list from the paper itself. Each links out to its DOI / PubMed record.
- 1[1] Noga Alon, Raphael Yuster, and Uri Zwick, Color-coding , Journal of the ACM 42 (1995), no. 4, 844–856, doi:10.1145/210332.210337 , MR 1411787. · doi ↗
- 2[2] Hans L. Bodlaender, On linear time minor tests with depth-first search , Journal of Algorithms 14 (1993), no. 1, 1–23, doi:10.1006/jagm.1993.1001 , MR 1199244. · doi ↗
- 3[3] Paul Bonsma, The complexity of rerouting shortest paths , Theoretical Computer Science 510 (2013), 1–12, doi:10.1016/j.tcs.2013.09.012 , MR 3122210. · doi ↗
- 4[4] Marzio De Biasi and Tim Ophelders, The complexity of Snake , 8th International Conference on Fun with Algorithms, FUN 2016, June 8–10, 2016, La Maddalena, Italy (Erik D. Demaine and Fabrizio Grandoni, eds.), Leibniz International Proceedings in Informatics (LIP Ics), vol. 49, Schloss Dagstuhl – Leibniz-Zentrum für Informatik, 2016, pp. 11:1–11:13, doi:10.4230/LIP Ics.FUN.2016.11 . · doi ↗
- 5[5] Chandan Dubey, Uriel Feige, and Walter Unger, Hardness results for approximating the bandwidth , Journal of Computer and System Sciences 77 (2011), no. 1, 62–90, doi:10.1016/j.jcss.2010.06.006 , MR 2767125. · doi ↗
- 6[6] Michael R. Fellows and Michael A. Langston, On search, decision, and the efficiency of polynomial-time algorithms , Journal of Computer and System Sciences 49 (1994), no. 3, 769–779, doi:10.1016/S 0022-0000(05)80079-0 , MR 1306142. · doi ↗
- 7[7] Siddharth Gupta, Guy Sa’ar, and Meirav Zehavi, The parameterized complexity of motion planning for snake-like robots , Electronic preprint arxiv:1903.02445, March 2019.
- 8[8] Tesshu Hanaka, Takehiro Ito, Haruka Mizuta, Benjamin Moore, Naomi Nishimura, Vijay Subramanya, Akira Suzuki, and Krishna Vaidyanathan, Reconfiguring spanning and induced subgraphs , Computing and Combinatorics: 24th International Conference, COCOON 2018, Qing Dao, China, July 2–4, 2018, Proceedings (Lusheng Wang and Daming Zhu, eds.), Lecture Notes in Computer Science, vol. 10976, Springer, 2018, pp. 428–440, ar Xiv:1803.06074 , doi:10.1007/978-3-319-94776-1_36 . · doi ↗
