# Parameterized complexity of reconfiguration of atoms

Our work is motivated by the challenges presented in preparing arrays of atoms for use in quantum simulation. The recently-developed process of loading atoms into traps results in approximately half of the traps being filled. To consolidate the atoms so that they form a dense and regular arrangement, such as all locations in a grid, atoms are rearranged using moving optical tweezers. Time is of the essence, as the longer that the process takes and the more that atoms are moved, the higher the chance that atoms will be lost in the process. Viewed as a problem on graphs, we wish to solve the problem of reconfiguring one arrangement of tokens (representing atoms) to another using as few moves as possible. Because the problem is NP-complete on general graphs as well as on grids, we focus on the parameterized complexity for various parameters, considering both undirected and directed graphs, and tokens with and without labels. For unlabelled tokens, the problem is in FPT when parameterizing by the number of tokens, the number of moves, or the number of moves plus the number of vertices without tokens in either the source or target configuration, but intractable when parameterizing by the difference between the number of moves and the number of differences in the placement of tokens in the source and target configurations. When labels are added to tokens, however, most of the tractability results are replaced by hardness results.

## Authors

• 1 publication
• 1 publication
• 4 publications
• 4 publications
• ### Parameterized complexity of untangling knots

Deciding whether a diagram of a knot can be untangled with a given numbe...
11/09/2021 ∙ by Clément Legrand-Duchesne, et al. ∙ 0

• ### Shortest Reconfiguration of Matchings

Imagine that unlabelled tokens are placed on the edges of a graph, such ...
12/13/2018 ∙ by Nicolas Bousquet, et al. ∙ 0

• ### Token Swapping on Trees

The input to the token swapping problem is a graph with vertices v_1, v_...
03/16/2019 ∙ by Ahmad Biniaz, et al. ∙ 0

We propose Masker, an unsupervised text-editing method for style transfe...
10/02/2020 ∙ by Eric Malmi, et al. ∙ 0

• ### Finding Optimal Solutions to Token Swapping by Conflict-based Search and Reduction to SAT

We study practical approaches to solving the token swapping (TSWAP) prob...
06/25/2018 ∙ by Pavel Surynek, et al. ∙ 0

• ### Parameterized Complexities of Dominating and Independent Set Reconfiguration

We settle the parameterized complexities of several variants of independ...
06/30/2021 ∙ by Hans L. Bodlaender, et al. ∙ 0

• ### Characterizing Universal Reconfigurability of Modular Pivoting Robots

We give both efficient algorithms and hardness results for reconfiguring...
12/14/2020 ∙ by Hugo A. Akitaya, et al. ∙ 0

##### This week in AI

Get the week's most popular data science and artificial intelligence research sent straight to your inbox every Saturday.

## 1 Introduction

To maximize the probability of success in arranging atoms, approaches need to minimize the probability of atoms being lost during the time between the array being loaded and the atoms being arranged. The lifetime of trapped atoms is short and limited, and the process of moving an atom may result in the loss of the atom. Previous work

[PhysRevA.102.063107] has focused on minimizing the total time required, including both the generation and the execution of the sequence of steps, and consequently has aimed to minimize the number of moves.

The rearrangement of atoms can be framed as a reconfiguration problem; the reconfiguration framework [IDHPSUU11, H13, DBLP:journals/algorithms/Nishimura18, CHJ08, IDHPSUU11, IKD12, DBLP:journals/talg/LokshtanovM19] characterizes the transformation between configurations by means of a sequence of reconfiguration steps. By representing atoms as tokens, we can define each configuration of unlabelled tokens as a subset of vertices of a graph, indicating that there is a token placed on each vertex in the subset; for tokens with labels, a labelled configuration consists of a sequence of vertices in a graph, where the position of a vertex in the sequence corresponds to its label. One configuration can be transformed into another by a sequence of moves, where in each move a token is moved from one vertex to another along a token-free path.

Since finding a shortest sequence of moves between configurations is NP-hard, even when restricted to grids [DBLP:journals/siamdm/CalinescuDP08], we turn to the field of parameterized complexity [DF97, flumgrohe, niedermeier2006, saurabh-book], which studies the impact of one or more parameters on the running time of algorithms. A problem is in FPT if there exists an algorithm with worst-case running time bounded by for the size of the instance, the size of the parameters, and a computable function; analogous to NP-hardness in the realm of classical complexity are the classes of intractable problems in the W-hierarchy such as W[1] and W[2].

We explore the fixed-parameter tractability of the problem for unlabelled and labelled tokens on undirected and directed graphs, with respect to various parameters, namely, the number of tokens (), the number of moves (), the number of token-less vertices outside the source and target configurations (), and the number of moves exceeding the minimum possible for any instance (namely, the number of differences between the source and target configurations). Our results are summarized in Table 1.

## 2 Terminology

We formulate our problems in terms of the moving of tokens in a graph, using the notation for an undirected graph and for a directed graph. The reader is directed to a standard textbook on graph theory [DBLP:books/daglib/0030488] for definitions of graph classes and other terminology.

We define a move as a pair , where is the source vertex of the move and is the target vertex of the move. The execution of the move results in the change from a configuration containing to a configuration containing , where the same label is mapped to and , with the rest of the configuration remaining unchanged. In order to ensure that atoms do not collide, a move cannot pass through a vertex that contains a token. A vertex is free if there is no token on it, and a path (directed or undirected) is free if all intermediate vertices in the path are free. A move in a sequence is valid if, after the execution of the previous moves in the sequence, there is a token on , is free, and there is a free path from to , which we designate as the path for the move. For a sequence of valid moves in a graph (respectively, ), we use () to denote the graph induced on the union of edges in the paths for the moves in .

The execution of a sequence of valid moves transforms a configuration into another configuration if executing the moves starting from results in tokens being placed as in configuration . We will call such a sequence of valid moves a transforming sequence for and or, when and are clear from context, simply a transforming sequence. In defining a sequence of indices, we use to denote .

We define the four problems Unlabelled Undirected Token Moving (UUTM), Unlabelled Directed Token Moving (UDTM), Labelled Undirected Token Moving (LUTM), and Labelled Directed Token Moving (LDTM) as follows:

Input (UUTM)

An undirected graph and configurations and such that and an integer

Input (UDTM)

A digraph and configurations and such that and an integer

Input (LUTM)

An undirected graph and labelled configurations and such that and an integer

Input (LDTM)

A digraph and labelled configurations and such that and an integer

Output (all problems)

A transforming sequence of length at most

Unless specified otherwise, all definitions apply to instances of UUTM and LUTM as well as instances of UDTM and LDTM. We refer to as the source configuration, as the target configuration, as the set of obstacles, and as the symmetric difference of and . In a clearing move, the source vertex is an obstacle and in a filling move, the target vertex is an obstacle.

When discussing parameters, we use to denote and to denote or (the number of vertices without tokens in either or ).

We will refer to an instance (respectively, ) when discussing the length of a shortest transforming sequence from to in (). Two instances are equivalent if the lengths of the shortest transforming sequences of the instances are equal.

For a (directed) path between a pair of vertices and , any token on a vertex other than or is said to block that path. If all paths between a pair of vertices and are blocked, then we say that the move is blocked. For shorthand, when the presence of a token on a vertex results in a move being blocked, we’ll say that is blocked by .

The observations below follow from the definitions:

If a vertex blocks move in (respectively, ), then there exists a path (resp., directed path) from to .

Suppose that is the last move in a transforming sequence from to . The sequence formed from by removing is a transforming sequence from to a configuration , where differs from by having a token on instead of on .

Taken together, we can use the observations to detect the existence of free paths:

For , , , , and as in Observation 2, suppose there exists a transforming sequence from to a configuration , where differs from by a single token, where has a token on a vertex and has a token on a vertex . Then if is blocked after the execution of on , there must be a free (directed, if in ) path from to .

###### Proof.

We know that is valid in and hence is valid after the execution of . The only difference between and is the presence of a token on instead of , so the only vertex that can block is . The fact that is the only reason that there is not a free path from to , combined with Observation 2, implies that there is a free (directed) path from to . ∎

## 3 Fixed-parameter tractability results

### 3.1 Preliminaries

We first establish properties of shortest transforming sequences that allow for clean proofs of our results. Călinescu et al. [DBLP:journals/siamdm/CalinescuDP08] have shown that in any unlabelled undirected graph, it is possible to transform any configuration into another by a single move of each token; in Lemma 3.1, we show that even for shortest transforming sequences, we can assume no token moves twice.

For any instance of UUTM or any instance of UDTM, there exists a shortest transforming sequence in which no token moves more than once.

###### Proof.

We provide the proof for the directed case, which implies the undirected case. We assume to the contrary that there exists an instance for which any shortest transforming sequence requires the move of at least one token a second time. We minimize the length of the subsequence of moves starting at the first move of a token and ending at the second move of the same token. We can represent as , where the move . Since the first and last move are of the same token, .

To prove the lemma, it suffices to show that we can form a shorter sequence of moves, , such that and result in the same configuration and is shorter than . We will refer to moves of the form as matching moves and moves of the form as offset moves; a sequence of matching (offset) moves consists of moves for consecutive values of .

We construct as a sequence of segments (Figure 1), where each segment is formed by adding zero or more valid offset moves until a blocked offset move is reached, adding all valid matching moves starting at until a blocked matching move is reached, and then adding the linking move . The next segment will start by attempting to add the offset move .

To prove that the moves in the segments are all valid, we first show that , the first move in the first segment, is valid. We know that in , is valid after is executed, but since is of minimum length, cannot be executed before . Since results in a free path between and , we know that must contain the only token on an intermediate vertex on a path from to , and hence there are free paths from to each of and .

To show that all of is valid, we prove the following statements by induction on the number of segments executed so far.

1. The first matching move in any segment is valid.

2. The linking move in any segment is valid.

To show that part (1) holds, we suppose instead that the matching move is blocked after the execution of . By the definition of the algorithm, we are attempting to add because is not valid.

Because the matching move is valid in , by Observation 2, we can then conclude that blocks the move, and that there is a free path from to , contradicting the assumption is not valid.

For part (2), we consider the placement of tokens in and at the point at which is blocked. By Observation 2, the fact that the is valid in but not in implies that there is a free directed path from to , and hence is valid.

Finally, we complete the proof by showing that and result in the same configuration. By the end of the first moves in , the only difference between the configuration obtained by the end of the first moves in is that there is no token on and a token on . Thus, no further moves are required in to achieve the configuration reached in by the final move, . ∎

We use Lemma 3.1 to show that we can find an equivalent instance in which every vertex is in ; we refer to such an instance as a contracted instance. We use contracted instances to form algorithms when parameterizing by .

For any instance of UUTM or any instance of UDTM, we can form an equivalent contracted instance or .

###### Proof.

Since by Lemma 3.1 we know that a vertex is never the source vertex nor the target vertex of a move, the only role it can play is in connecting its neighbours. We form from by adding an edge between each pair of neighbours of each such vertex .

To form , we instead add an arc from each in-neighbour of to each out-neighbour of , where . Vertices corresponding to those in and form and . ∎

UUTM and UDTM admit an vertex-kernel when parameterized by . Moreover, the problems can be solved in time.

###### Proof.

The size of the kernel follows directly from Lemma 3.1. To form the algorithm, we observe by Lemma 3.1 that it suffices to determine the set of obstacles that are sources of moves, the pairing of sources and targets into moves, and the order of moves. The number of moves will be at most , allowing us try all possible choices of vertices in , pairings, and orders in the stated time bound. ∎

### 3.2 Unlabelled Undirected Token Moving

Our algorithm for Unlabelled Undirected Token Moving relies on the characterization of the graph of a transforming sequence of minimum length of a contracted instance. In Lemmas 3.2 and 3.2, we show that there exists such that is a forest of minimum Steiner trees. By considering all possible ways of partitioning vertices in into trees, and counting the number of moves required by each choice, in Theorem 3.2 we are able to obtain an FPT algorithm for the UUTM problem parameterized by on contracted instances, and hence by Lemma 3.1, for all instances.

For any contracted instance of UUTM, there exists a transforming sequence of minimum length such that is a forest.

###### Proof.

Suppose to the contrary that each transforming sequence of minimum length induces a graph containing a cycle. Of these, we consider the minimum length of the subsequence of consisting of the moves bracketing the formation of the first cycle in : for the first cycle formed, we start with the first move such that the path for the move contains a vertex in , and end with the first move that completes . We use to refer to the sequence formed by removing the last move from , and to refer to the last move in .

In the graph , we use to denote the configuration before is executed, to denote the configuration after is executed, and to denote the configuration after is executed (Figure 2 (a)). By definition, and differ only in the placement of a single token, which can be found on in and on in .

Since completes the cycle , we can decompose into two paths between a pair of vertices and , where and are both on the path for the move . We use to denote the path between and that is part of and to denote the path between and that is part of the path for the move (Figure 2 (b)).

Our goal is to form an alternative sequence of valid moves such that can be used instead of to reach configuration . To make this possible, we identify the token on a vertex on in that is closest to in . We will show that we can find a sequence of moves that when executed on configuration , results in a configuration that differs from only in the placement of a single token, where has a token on and has a token on . We can then execute the move to reach configuration from .

To obtain a contradiction and complete the proof, we need to show that uses no intermediate vertices of and that the length of is no greater than the length of . We form a tree that we initialize to be , and for each of and that is not in , we add to a subpath of the path for the move with one endpoint in , the other endpoint the vertex or , and all intermediate vertices (if any) not in . The fact that closes the cycle guarantees that if and are not in , such paths exist, and that they contain no intermediate vertices of (Figure 2 (b)).

To compare the lengths of and , we first observe that by construction, every token in must be moved in order to transform into . Since is a tree, we can invoke the polynomial-time algorithm of Călinescu et al. [DBLP:journals/siamdm/CalinescuDP08], allowing us to obtain a shortest sequence of valid moves from to in to form . Since the modification of to did not increase the number of tokens, by Lemma 3.1, the number of moves in cannot be greater than the number of tokens, and hence not greater than the number of moves in , as required to complete the proof. ∎

For a contracted instance of UUTM and a transforming sequence of minimum length such that is a forest, each tree in the forest is a minimum Steiner tree with terminals and leaves in and internal vertices in , and such that each internal vertex in is the source vertex of a move.

###### Proof.

The fact that the leaves of the tree are in follows from the minimality of the length of . Because each token in must be moved in a contracted instance , a minimum Steiner tree will contain the minimum number of vertices and hence the minimum number of moves. ∎

UUTM is in FPT when parameterized by .

###### Proof.

We first form an equivalent contracted instance (Lemma 3.1), and then attempt all possible partitions of vertices in into at most Steiner trees, starting first with a single tree, then two, and so on.

When considering use of trees, we first consider all possible ways of partitioning the vertices of into groups, where each group has equal number of vertices in and , and then run the FPT Steiner tree algorithm [DreyfusWagner] on each such set of vertices. Because in each Steiner tree each token must move, the number of moves associated with each tree will be . If the total number of moves is at most we have a yes-instance. If we have not succeeded using trees to verify that the instance is a yes-instance, we try with the next value of . If none of the values succeed, we conclude that is a no-instance.

The correctness of the algorithm follows from Lemmas 3.2 and 3.2. ∎

### 3.3 Unlabelled Directed Token Moving

Like in the case of undirected graphs, our algorithm for the directed case relies on the characterization of the graph of a transforming sequence of minimum length of a contracted instance. We show, in Lemma 3.3, that for any yes-instance there exists an such that is a directed forest. As a replacement for the Steiner tree approach, the fact that we can bound the size of suggests the use of the machinery of color coding, introduced by Alon et al. [DBLP:reference/algo/AlonYZ08] (similar to a result obtained by Plehn and Voigt [DBLP:conf/wg/PlehnV90]), to determine whether contains a labelled subgraph of the correct form to be for a contracted yes-instance. Unfortunately, Theorem 3.3 cannot be used directly; in Theorem 3.3 we adapt the technique for our purposes.

[[DBLP:reference/algo/AlonYZ08]] Let be a directed forest on vertices. Let be a directed -vertex graph. A subgraph of isomorphic to , if one exists, can be found in worst-case time. Moreover, if a real-weight function is defined on the edges of , then the algorithm can be adapted to find the copy of in with the maximal total weight.

After removing extraneous vertices (Lemma 3.3), we demonstrate that forms a forest (Lemma 3.3); to show that we can ignore cycles, we focus on a minimal graph containing a cycle as a counterexample. More formally, we call a directed graph a circle graph if is connected and the vertices in can be partitioned into cycle vertices, forming a simple cycle in the underlying undirected graph, and forest vertices, forming a forest of trees attached to the cycle vertices, where in each tree either all arcs are directed towards the root or all arcs are directed away from the root. An instance of UDTM is said to be a contracted circle instance whenever is a circle graph and .

For a contracted instance of UDTM and , is a yes-instance if and only if is a yes-instance when any of the following conditions hold:

1. There is no directed path from any vertex in to .

2. There is no directed path from to any vertex in .

3. Every directed path from any vertex in to contains at least obstacles and every directed path from to any vertex in contains at least obstacles.

###### Proof.

By Lemma 3.1, in any shortest transforming sequence, either is the source of a clearing move and the target of a filling move, or it blocks the move of another token. Because each pair of clearing and filling moves forms a directed path from a vertex in to a vertex in (as does any move with source vertex in and target vertex in ), under the first two conditions can neither be part of such a move nor block such a move.

For the third condition, we observe that moves are not sufficient either to move enough other obstacles for there to be a clear path between and a vertex in , nor for to be the only obstacle blocking a path. ∎

If there exist instances of UDTM such that for every transforming sequence of minimum length, is not a forest, then at least one of those instances must be a contracted circle instance.

###### Proof.

Of all those instances, let us consider an instance where is minimized, is minimized, and the length of a shortest transforming sequence is minimized (in that order). We call such an instance a minimal instance.

We first show that in a minimal instance, the last move in the shortest transforming sequence is the one that induces one or more cycles in . Suppose to the contrary that the first cycle is formed by a move that is not the last in the sequence. We then define to be the configuration after is executed. The instance satisfies the statement of the lemma and the shortest transforming sequence consists of at least one fewer moves, contradicting the minimality of the instance.

We now show that cannot contain more than one connected component nor more than one cycle. If instead contains more than one connected component, since the moves in each component are independent of each other, the moves forming the components not containing the cycle could have all taken place after the last move in , contradicting the minimality of the length of . If the last move closes more than one cycle then we let be the graph induced on all moves prior to and we let denote the path induced by . We let , , and be the first, second, and third intersections of with such that and , respectively. Such vertices must exist since is assumed to close more than one cycle. We note that we could have longer paths between and or between and but the same argument still applies. We create a new instance by deleting all edges between and and all edges between and and we instead add an edge from to ; since the path from to has at least three edges, we have found a smaller instance that uses fewer edges, contradicting the minimality of . Hence, in a minimal instance, consists of a single component containing a single cycle.

We can assume that each vertex is the source or target of a move, as the transformation in the proof of Lemma 3.1 results in a connected graph with a single cycle. Moreover, due to the minimality of , cannot contain any move that does not pass through . Consequently, any vertex outside of must either be connected by a directed path to a vertex in or connected by a directed path from a vertex in , forming a contracted circle instance. ∎

We use Lemma 3.3 in the proof of Lemma 3.3, where we use the structure of a circle graph to form a transforming sequence. We number the cycle vertices as , , , in clockwise order, observe that for each , either or is an arc in . We say that a subsequence of vertices is a forward cycle segment if is an arc for each and a backward cycle segment if is an arc for each . Since the paths of moves are directed paths, no move can use edges in more than one cycle segment.

Of particular interest are the junction vertices shared by two consecutive cycle segments, where each is either a source or a sink in both cycle segments. We refer to the in-pool of a source junction vertex as the set containing and any tree vertex that can reach by a directed path, and the out-pool of a sink junction vertex as the set containing and any tree vertex that can be reached by a directed path from . Since each cycle segment starts and ends with a junction vertex, we can refer without ambiguity to the in-pool and out-pool of a cycle segment. By partitioning the moves by cycle segments, we form a sequence of directed trees, thereby allowing us to apply Lemma 3.3.

Given a directed tree , two configurations and of such that every leaf of is in , and a one-to-one mapping from to such that there is directed path from each to (and for all ), then there exists a transformation from to in .

###### Proof.

We proceed by induction on the size of the tree , observing that if then the statement clearly holds.

If there exists a leaf , we let and we let be the unique directed path from to . We let be the closest vertex to on such that . Note that could be equal to . Moreover, all vertices in are in . Then, we form a smaller instance and configurations and as follows. If then we delete from (and ), we remove from , and we set ; since we have a directed path from to and a directed path from to , we have a directed path from to . If then we simply delete from and if becomes a leaf we also delete . When does not become a leaf it becomes a free vertex (not in ). To form a transforming sequence from to in , we start with the move and then add the transforming sequence for the smaller instance.

Now we consider the situation in which all the leaves of are in . For a leaf , we let and, again, we let be the unique directed path from to . We find the closest vertex to on such that . All the vertices in are in . We let (assuming ) and . We can form a smaller instance by removing , and form a transforming sequence from the transforming sequence of the smaller instance followed by the move . To do so, we set and ; by construction, there is a directed path from to , from to , and from to . If then we let and form the smaller instance in a similar manner but setting . ∎

For any contracted yes-instance of UDTM, there exists a transforming sequence of minimum length such that is a directed forest.

###### Proof.

For the sake of contradiction, we assume that is an instance for which for any of minimum length, contains a cycle. By Lemma 3.3 we can assume that is a contracted circle instance, is the last move in , contains a single cycle, is formed by removing from , and is a forest.

As in the proof of Lemma 3.2, we decompose the cycle into two undirected paths and in the underlying undirected graph, both between the vertices and , where and are both on the path for the move . We focus on the path that is not part of the move . We break into cycle segments, and show how to create a sequence of moves that results in the same configuration as but does not use . In forming , we will find a sequence of linked moves, where for any two moves and , we will say that and are linked if there is directed path from to .

In choosing linked moves, we consider only moves that use arcs of . Since each move can use arcs of only a single cycle segment, we can partition the moves into sets , where corresponds to the segment that includes and the cycle segment that includes . We will form a linked sequence starting with a move with source , ending with a move with target , and consisting of a sequence of moves for each cycle segment.

Because every arc in the cycle must be part of a move, for any forward cycle segment, we can find a sequence of moves such that the source of the first move is in the in-pool, the target of the last move is in the out-pool, and all moves are linked. Similarly, for any backward cycle segment, we can find a sequence where the target of the first move is in the out-pool, the source of the last move is in the in-pool, and all moves are linked. Further, we can link the first and last moves of the sequences of linked moves associated with consecutive cycle segments, since targets of moves in consecutive cycle segments using the same out-pool can be reached by the sources of both moves, and sources of moves in consecutive cycle segments using the same in-pool can reach the targets of both moves.

We now form a sequence of the same length as , but which does not use . By Lemma 3.3, it suffices to form a mapping between sources and sinks such that there is a directed path between each and . We observe that there is a path from to a vertex in the out-pool of the first backward cycle segment, allowing us to map to the target of the first move for that cycle segment. Using the definition of linked moves, for each pair of linked moves and , we can set to for each . Finally, since there is path to from the in-pool of the last forward segment, is set to the source of the last move for that cycle segment. ∎

To check if is a contracted yes-instance, it suffices to determine whether or not a labelled version of contains a subgraph of the correct form to be . We assign labels to vertices of such that the vertices of are labelled from to , the vertices of are labelled from to , and all other vertices are assigned label . Thus, we have distinct labels. We say that is ()-labelled and use to denote the label of vertex . In , all vertices not in receive label .

When is a contracted yes-instance with a transforming sequence of minimum length, has at most vertices, as otherwise moves are required. Thus, we can enumerate all possible -labelled directed graphs of size at most and check whether any one of them implies a yes-instance and can be found as a subgraph of . For a -labelled directed forest, we let and . Then, is said to be a witness for if is a yes-instance and a subgraph isomorphic to can be found in such that the labelling of the vertices in is respected.

UDTM is in FPT when parameterized by .

###### Proof.

For any instance of UDTM, we can transform the instance using Lemmas 3.1 and 3.3 to form a contracted instance such that for every vertex (that is, every vertex in the graph), is on a directed path from a vertex in to a vertex in .

By Lemma 3.3, we know that if is a yes-instance, then there exists a transforming sequence of minimum length such that is a directed forest. For any contracted yes-instance of UDTM, at most moves can be of tokens outside of . Hence, the total number of vertices in is at least and at most .

To check if is a yes-instance, we search for a witness by enumerating all -labelled directed forests on vertices, for each value . We observe that the total number of such forests is bounded by a function of . For each forest , we determine whether is a witness by determining whether is a yes-instance (which can be achieved in FPT by brute force) and whether there is a subgraph of isomorphic to that respects the labels.

To check subgraph isomorphism, we create edge-weighted digraphs and with vertices corresponding to those in and . We assign all edges in weight one. Each vertex in and corresponding to a vertex with label is given degree-one in-neighbors, connected by arcs with weight , and each vertex in and corresponding to a vertex with label is given degree-one out-neighbors, connected by arcs with weight .

We can now invoke Theorem 3.3 on and . If is isomorphic to , then the copy of in with maximal total weight will include all the edges of weight greater than one, thereby providing a label-preserving isomorphism; otherwise, we have a no-instance. ∎

## 4 Hardness results

### 4.1 Preliminaries

To strengthen some of our hardness results, we prove that for any instance of UDTM we can find an equivalent instance that is of degree at most three (Lemma 4.1) or 2-degenerate (Lemma 4.1).

For any instance of UDTM, we can form an equivalent instance such that has maximum degree three.

###### Proof.

We form from by constructing a gadget for each vertex, where the gadget for a vertex with in-degree and out-degree will consist of a directed path of vertices (Figure 4 (a)). The first vertices are the in-vertices of , the next vertex is the central vertex of , and the remaining vertices are the out-vertices of .

For any arc in , we connect the gadgets for and by adding an arc from an out-vertex of to an in-vertex of . Because each vertex has one in-vertex for each in-neighbor in and one out-vertex for each out-neighbor in , each of the in-vertices and out-vertices have degree exactly three, and the central vertex has degree exactly two.

Finally, to form and , we choose the central vertices for each vertex in and , respectively. The equivalence of the instances follows directly from the fact that any path in corresponds to a path in , where passes through a sequence of central vertices corresponding to the intermediate vertices in . ∎

For any instance of UUTM or any instance of UDTM, we can form an equivalent instance or such that or is 2-degenerate.

###### Proof.

We simply subdivide each edge any constant amount of times (maintaining direction in the case of directed graphs). By Lemma 3.1 we know that the “new” vertices are never the source vertex nor the target vertex of a move. ∎

### 4.2 Parameter ℓ−|S∖T|

The problems UUTM, UDTM, LUTM, and LDTM are W[2]-hard when parameterized by .

###### Proof.

We demonstrate parameterized reductions from Red-Blue Dominating Set, known to be W[2]-hard [DF97], which determines for a bipartite graph of blue and red vertices and an integer , whether contains a subset of size at most such that each vertex in is the neighbor of a vertex in .

Each of the reductions makes use of a different modification to the “broom graph” construction of Călinescu et al. [DBLP:journals/siamdm/CalinescuDP08]. For LDTM, we form a graph such that , where and contain one vertex for each vertex in and , respectively, , and is a directed path of length . There is an arc from the last vertex in to all vertices in , arcs from the vertex in corresponding to to all the vertices in corresponding to the neighbors of in , and a cycle of length two between each vertex in and a distinct vertex in (Figure 4 (b)).

We set , , and . Since , .

By Lemma 3.1, we can assume that the moves consist of moves of tokens from to , clearing moves, and filling moves; by construction, clearing moves will move tokens from to . A selection of vertices in for the clearing and filling moves will be possible only when is a yes-instance of Red-Blue Dominating Set, since otherwise it will not be possible to create free paths from all of to all of .

The reductions for the remaining problems are similar. For LUTM, all edges are undirected; it thus suffices to have a single edge between each vertex in and its corresponding vertex in . For UUTM and UDTM, is empty and . The tokens in are moved to , and the remaining moves are moves from to followed by filling moves from to . As for the other reductions, a transforming sequence is possible only when is a yes-instance. ∎

Finally, we use Lemmas 4.1 and 4.1 to obtain the following results.

UUTM is W[2]-hard when parameterized by , even when restricted to 2-degenerate graphs.

UDTM is W[2]-hard when parameterized by , even when restricted to 2-degenerate graphs of maximum degree three.

### 4.3 Parameter ℓ+f

We now show that LUTM and LDTM are W[1]-hard parameterized by or on general graphs. We give reductions from the Multicolored Subgraph Isomorphism problem, which determines whether there is a subgraph of a vertex-colored graph that is isomorphic to a vertex-colored graph . The problem is W[1]-hard when parameterized by solution size, even when is a 3-regular connected bipartite graph [DBLP:journals/toc/Marx10]. We define to be a connected 3-regular bipartite graph such that , and use to denote the color of a vertex .

Both of our reductions create a node-vertex for each and then use the structure of to group node-vertices by color to form supernodes. By judicious assignment of labels to tokens moving between supernodes, we ensure that reconfiguration can occur only if we can clear tokens on a set of node-vertices that form a subgraph of isomorphic to . We start with the directed case and then explain modifications for the undirected case.

#### 4.3.1 Labelled Directed Token Moving

We explain the reduction in three steps: (1) forming a DAG from to provide the structure of , (2) creating and connecting supernodes, and (3) adding gadgets to constrain movement of tokens.

Step 1. To form a DAG , we create a vertex for each vertex , making use of breadth-first search to assign each vertex to a level. Choosing an arbitrary vertex of for the sole vertex at level 0 in , we assign each remaining vertex to the minimum level such that there is a path of vertices from to in . By adding the edges forming the breadth-first search tree and directing them from vertices at smaller levels to larger levels, we form a directed acyclic graph (Figure 5 (c)). By our construction, each arc connects vertices in adjacent levels.

Step 2. We can safely ignore any edge in between vertices of the same color or between colors not connected by an edge in , as no such edge can form part of a subgraph of isomorphic to . For each color , supernode consists of all node-vertices such that in ; we consider to be at the same level as in . To form , we add an arc between any vertex and such that is an arc in and is an edge in (Figure 6 (a)). When there exists an arc between vertices in and , we say that is a super-in-neighbor of and that is a super-out-neighbor of .

Step 3. In order to ensure that each edge is traversed, we associate a token with each arc in , where for arc , in the token is assigned to a source gadget in , and in , the token is assigned to a target gadget in . Accordingly, we choose token labels so that for each supernode, there is one token in its source gadget for each super-out-neighbor, and there is one vertex in its target gadget for each super-in-neighbor. For each token in , its source vertex and target vertex are in consecutive levels.

For LDTM, the source gadget attached to a supernode consists of a set of vertices with tokens connected by arcs into each node-vertex in the supernode and the target gadget consists of a set of vertices without tokens connected by arcs from each node-vertex in the supernode (Figure 6 (b)). In addition, associated with each supernode is a storage gadget consisting of a single vertex that is the in-neighbor and out-neighbor of every node-vertex in the supernode. As their names suggest, the union of the vertices in the source gadgets equals and the union of the vertices in the target gadgets equals .

To complete the construction for LDTM, we set to all vertices in source gadgets, to all vertices in target gadgets, and to all node-vertices. By construction, and ; we set .

If is a yes-instance of Multicolored Subgraph Isomorphism, then is a yes-instance of LDTM.

###### Proof.

We will specify a sequence of moves, consisting of clearing moves, moves of vertices in to vertices in , and finally filling moves.

Using the fact that is a yes-instance, we define as the set vertices of in the subgraph isomorphic to . For our clearing moves, we move the tokens on for each to adjacent storage gadgets. Since each vertex has a different color, each is in a different supernode, and hence the storage gadgets are all distinct.

Moreover, for each arc in , we have cleared the endpoints of an edge from to in , allowing all the moves from to to take place. Finally, the tokens moved in the clearing moves can be returned to their original locations. ∎

If is a yes-instance of LDTM, then is a yes-instance of Multicolored Subgraph Isomorphism.

###### Proof.

Due to sizes of and , the transforming sequence consists of clearing moves, moves of vertices in to vertices in , and filling moves, although the order among them is unconstrained. As a consequence of the construction, we observe that before the move of a token from a source gadget attached to to a target gadget attached to , there must be two clearing moves, one of a node-vertex in and one of a node-vertex in such that .

To be able to clear enough vertices to allow all moves of tokens from source gadgets to target gadgets, we must be able to select node-vertices to move such that for every edge in , there is an edge such that , , and the vertices and have both been cleared. By definition, the selected node-vertices correspond to the vertices in a subgraph of isomorphic to , and hence to , proving that is a yes-instance of the Multicolored Subgraph Isomorphism problem. ∎

Combining Lemmas 4.3.1 and 4.3.1 with the fact that , we obtain the following theorem.

LDTM is W[1]-hard when parameterized by .

#### 4.3.2 Labelled Undirected Token Moving

We use the same basic structure as in the previous reduction, but need extra machinery to ensure that a token moving from to is unable to find a route that avoids all edges corresponding to edges in with endpoints of colours and . To this end, we introduce superedges and a clock gadget, defined below, and for each arc , specify the numbers of tokens to move from to and to based on the level. Source gadgets, target gadgets, and storage gadgets all consist of vertices connected by a single undirected edge to all node-vertices in a supernode.

To construct for LUTM, we construct supernodes in the same way as in , and although is undirected, use the terms level, super-in-neighbor, and super-out-neighbor based on the structure of . In addition, we form an edge-path of length (to be defined later) for each edge in , and for each arc in , we form a superedge consisting of all edge-paths such that and . The level of is considered to be the same as the level of . To connect the node-vertices and edge-paths in (Figure 7), for each superedge and each edge-path in , we add an edge from to one end of and an edge from the other end of to .

For convenience, we refer to the tokens in the source gadget attached to destined for the target gadget attached to as the - tokens. Our proofs hinge on showing that the - moves pass through superedge . To limit possible paths, for each supernode at level , we create - tokens and - tokens, where for the last level , and for any level , .

The clock gadget is designed to allow the freeing of edge-paths in superedges one at a time in increasing order of level, which we call the clock numbering (or just numbering) of the superedges. For large values and to be defined later, the clock gadget consists of storage paths , each of length , and linking paths , each of length . Referring to the two endpoints of each storage path as the top end and the bottom end and the two endpoints of each linking path as the left end and the right end, for each , we add edges connecting the bottom end of to the right end of (if it exists) and to the left end of (if it exists).

We view tokens for the clock gadget in as being grouped into clock segments, each containing tokens, such that is free before the movement of the tokens in the first clock segment from source to target vertices, is free between the movements of the first and second clock segments, and is free only after the movement of all of the clock segments. All vertices in are in , all vertices in are in , and for clock segment , the tokens are on and in , in order from left to right and bottom to top, and on and in , in order from top to bottom and left to right. We say that the clock is at position whenever the top end of does not have a token. Finally, we connect the top end of each to the middle vertex in each edge-path in the superedge numbered .

To complete the construction, we set to consist of vertices in the source gadgets, source vertices in the clock gadget, and all node-vertices and edge-paths, and to consist of vertices the target gadgets, target vertices in the clock gadget, and all node-vertices and edge-paths. The number of free vertices in is thus the total size of the storage gadgets, or .

We now choose large enough values of and to control token movement. We set , where is the total number of vertices in source gadgets in all supernodes. To determine the number of moves , we sum moves for the clock segments, moves of tokens from source to target gadgets, moves to clear and fill the node-vertices, and to clear and fill one edge-path in each superedge, or . We let , so that written in a more convenient form, we have .

If is a yes-instance of Multicolored Subgraph Isomorphism, then is a yes-instance of LUTM.

###### Proof.

We specify a sequence of moves that clears one node-vertex in each supernode, completes all the moves between and , and then fills the cleared node-vertices. As in the proof of Lemma 4.3.1, we define as the set of vertices of in the subgraph isomorphic to , and to clear node-vertices, we move the tokens on for each to adjacent storage gadgets.

Clearing node-vertices is not sufficient; the - moves are still blocked by tokens in . For each superedge numbered , we clear the edge-path corresponding to the edge in between vertices of colors and by moving the tokens into , execute the - moves, return the tokens from to the edge-path, and then move the tokens in clock segment to their target vertices (except for when ).

Using the node-vertices corresponding to the subgraph of isomorphic to , we can accomplish the transformation by clearing moves of the node-vertices, moves for each superedge, moves for the clock gadget tokens, moves between source and target gadgets of supernodes, and finally moves to fill the node-vertices. The total number of moves will be . ∎

Before we prove the reverse direction, we first show that for a yes-instance of LUTM, the clock gadget behaves as required: the clock can be in only one position at a time, “time” cannot go backwards, and at any point in the transformation, we can have at most one superedge with an edge-path free of tokens.

If is a yes-instance of LUTM then we cannot have and such that the top ends of both are free of tokens.

###### Proof.

If there exist and such that the top ends of both are free of tokens, then this implies that the tokens of at least one clock segment must move twice. Hence the number of moves required in the clock gadget will be at least . ∎

If is a yes-instance of LUTM, then after the clock reaches position it can never go back to position (or any earlier position).

###### Proof.

Assume that the clock reaches position and goes back to position . This implies that the clock would have to alternate from position , to , and back to . Hence, the total number of moves to transform the tokens on the clock to their target positions would be , a contradiction. ∎

If is a yes-instance of LUTM then at any point in the transformation we can have at most one superedge with an edge-path free of tokens. Morever, whenever superedge numbered has a free edge-path, then the clock must be at position .

###### Proof.

By construction, each edge-path in a superedge contains tokens. Since the total number of vertices in source gadgets, target gadgets, and storage gadgets is , at least one token of the free edge-path must have moved to the clock gadget. Since the top of is the only vertex in the clock gadget connected to the edge-path, the top of must have been free at the time of the move. ∎

If is a yes-instance of LUTM, then is a yes-instance of Multicolored Subgraph Isomorphism.

###### Proof.

In counting the total number of moves in any transforming sequence, we need to allot at least