# Shortest Reconfiguration Sequence for Sliding Tokens on Spiders

Suppose that two independent sets I and J of a graph with I = J are given, and a token is placed on each vertex in I. The Sliding Token problem is to determine whether there exists a sequence of independent sets which transforms I into J so that each independent set in the sequence results from the previous one by sliding exactly one token along an edge in the graph. It is one of the representative reconfiguration problems that attract the attention from the viewpoint of theoretical computer science. For a yes-instance of a reconfiguration problem, finding a shortest reconfiguration sequence has a different aspect. In general, even if it is polynomial time solvable to decide whether two instances are reconfigured with each other, it can be NP-hard to find a shortest sequence between them. In this paper, we show that the problem for finding a shortest sequence between two independent sets is polynomial time solvable for spiders (i.e., trees having exactly one vertex of degree at least three).

## Authors

• 2 publications
• 1 publication
• 6 publications
• ### On girth and the parameterized complexity of token sliding and token jumping

In the Token Jumping problem we are given a graph G = (V,E) and two inde...
07/03/2020 ∙ by Valentin Bartier, et al. ∙ 0

• ### Generating Shortest Synchronizing Sequences using Answer Set Programming

For a finite state automaton, a synchronizing sequence is an input seque...
12/20/2013 ∙ by Canan Güniçen, 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

• ### Cyclic Shift Problems on Graphs

We study a new reconfiguration problem inspired by classic mechanical pu...
09/23/2020 ∙ by Kwon Kham Sai, et al. ∙ 0

• ### StackSeq2Seq: Dual Encoder Seq2Seq Recurrent Networks

A widely studied non-deterministic polynomial time (NP) hard problem lie...
10/11/2017 ∙ by Alessandro Bay, et al. ∙ 0

• ### Some results on Vertex Separator Reconfiguration

We present the first results on the complexity of the reconfiguration of...
04/22/2020 ∙ by Guilherme C. M. Gomes, et al. ∙ 0

• ### Finding descending sequences through ill-founded linear orders

In this work we investigate the Weihrauch degree of the problem 𝖣𝖲 of fi...
10/08/2020 ∙ by Jun Le Goh, 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

Recently, the reconfiguration problems attracted the attention from the viewpoint of theoretical computer science. These problem arise when we like to find a step-by-step transformation between two feasible solutions of a problem such that all intermediate results are also feasible and each step abides by a fixed reconfiguration rule, that is, an adjacency relation defined on feasible solutions of the original problem. The reconfiguration problems have been studied extensively for several well-known problems, including Independent Set [11, 15, 16, 18], Satisfiability [10, 17], Set Cover, Clique, Matching [15], and so on.

A reconfiguration problem can be seen as a natural “puzzle” from the viewpoint of recreational mathematics. The 15-puzzle is one of the most famous classic puzzles, that had the greatest impact on American and European societies (see [22] for its rich history). It is well known that the 15-puzzle has a parity, and one can solve the problem in linear time just by checking whether the parity of one placement coincides with the other or not. Moreover, the distance between any two reconfigurable placements is , that is, we can reconfigure from one to the other in sliding pieces when the size of the board is . However, surprisingly, for these two reconfigurable placements, finding a shortest path is -complete in general [4, 20]. Namely, although we know that there is a path of length in , finding a shortest one is -complete. While every piece is a unit square in the 15-puzzle, we obtain the other famous classic puzzle when we allow to have rectangular pieces, which is called “Dad puzzle” and its variants can be found in the whole world (e.g., it is called “hako-iri-musume” in Japanese). Gardner said that “these puzzles are very much in want of a theory” in 1964 [9], and Hearn and Demaine gave the theory after 40 years [11]; they are -complete in general [12].

Summarizing up, these sliding block puzzles characterize representative computational complexity classes; the decision problem for unit squares can be solved in linear time just by checking parities, finding a shortest reconfiguration for the unit squares is -complete, and the decision problem becomes -complete for rectangular pieces. That is, this simple reconfiguration problem gives us a new sight of these representative computational complexity classes.

In general, the reconfiguration problems tend to be -complete, and some polynomial time algorithms are shown in restricted cases. Finding a shortest sequence in the context of the reconfiguration problems is a new trend in theoretical computer science because it has a great potential to characterize the class from a different viewpoint from the classic ones.

One of the important -complete problems is the Independent Set problem. For this notion, a natural reconfiguration problem called Sliding Token was introduced by Hearn and Demaine [11]. (See [16] for an overview on different reconfiguration variants of Independent Set.) Suppose that we are given two independent sets and of a graph such that , and imagine that a token (coin) is placed on each vertex in . For convenience, sometimes we identify the token with the vertex it is placed on and simply say “a token in an independent set.” Then, the Sliding Token problem is to determine whether there exists a sequence of independent sets of such that

• , , and for all , ; and

• for each , , there is an edge in such that and .

That is, can be obtained from by sliding exactly one token on a vertex to its adjacent vertex along an edge . Such a sequence , if exists, is called a -sequence in between and . We denote by a -tuple an instance of Sliding Token problem. If a -sequence in between and exists, we say that is reconfigurable to (and vice versa), and write . The sets and are the initial and target independent sets, respectively. For a -sequence , the length of is defined as the number of independent sets in minus one. In other words, is the number of token-slides described in . Figure 1 illustrates a -sequence of length between two independent sets and .

For the Sliding Token problem, linear-time algorithms have been shown for cographs (also known as -free graphs) [16] and trees [6]. Polynomial-time algorithms are shown for bipartite permutation graphs [8], claw-free graphs [3], cacti [13], and interval graphs [2] 222 We note that the algorithm for a block graph in [14] has a flaw, and hence it is not yet settled [21].. On the other hand, -completeness is also shown for graphs of bounded tree-width [19], planar graphs [11, 12], planar graphs with bounded bandwidth [25], and split graphs [1].

In this context, for a given yes-instance of Sliding Token, we aim to find a shortest -sequence between and . Such a problem is called the Shortest Sliding Token problem. As seen for the 15-puzzle, the Shortest Sliding Token problem can be intractable even for these graph classes which the decision problem can be solved in polynomial time. Moreover, in the 15-puzzle, we already know that it has a solution of polynomial length for two configurations. However, in the Sliding Token problem, we have no upper bound of the length of a solution in general. To deal with this delicate issue, we have to distinguish two variants of this problem. In the decision variant, an integer is also given as a part of input, and we have to decide whether there exists a sequence between and of length at most . In the non-decision variant, we are asked to output a specific shortest -sequence. The length is not necessarily polynomial in in general. When is super-polynomial, we may have that the decision variant is in , while the non-decision one is not in since it takes super-polynomial time to output the sequence. On the other hand, even when is a perfect graph and is polynomial in , the decision variant of Shortest Sliding Token is -complete (see [16, Theorem 5]). In short, in the decision variant, we focus on the length of a shortest -sequence, while in the non-decision variant, we focus on the construction of a shortest -sequence itself.

From this viewpoint, the length of a token sliding is a key feature of the Shortest Sliding Token problem. If the length is super-polynomial in total, there exists at least one token that slides super-polynomial times. That is, the token visits the same vertex many times in its slides. That is, some tokens make detours in the sequence (the notion of detour is important and precisely defined later). In general, it seems to be more difficult to analyze “detours of tokens” for graphs containing cycle(s). As a result, one may first consider the problem for trees. The Sliding Token problem on a tree can be solved in linear time [6]. Polynomial-time algorithms for the Shortest Sliding Token problem were first investigated in [26]. In [26], the authors gave polynomial-time algorithms for solving Shortest Sliding Token when the input graph is either a proper interval graph, a trivially perfect graph, or a caterpillar. We note that caterpillars is the first graph class that required detours to solve the Shortest Sliding Token problem. A caterpillar is a tree that consists of a “backbone” called a spine with many pendants, or leaves attached to the spine. Each pendant can be used to escape a token, however, the other tokens cannot pass through it. Therefore, the ordering of tokens on the spine is fixed. In this paper, we consider the Shortest Sliding Token problem on a spider, which is a tree with one central vertex of degree more than . On this graph, we can use each “leg” as a stack and exchange tokens using these stacks. Therefore, we have many ways to handle the tokens, and hence we need more analyses to find a shortest sequence. In this paper, we give an time algorithms for the Shortest Sliding Token problem on a spider, where is the number of vertices. The algorithm is constructive, and the sequence itself can be output in time. As mentioned in [26], the number of required token-slides in a sequence can be , hence our algorithm is optimal for the number of token-slides.

Note: Recently, it is announced that the Shortest Sliding Token problem on a tree can be solved in polynomial time by Sugimori [23]. His algorithm is based on a dynamic programming on a tree [24]: though it runs in polynomial time, it seems to have much larger degree comparing to our case-analysis based algorithm.

## 2 Preliminaries

For common graph theoretic definitions, we refer the readers to the textbook [7]. Throughout this paper, we denote by and the vertex-set and edge-set of a graph , respectively. We always use for denoting . For a vertex , we denote by the set of neighbors of , and by the set of closed neighbors of . In a similar manner, for an induced subgraph of , the set is defined as . The degree of , denoted by , is the size of . For , the distance between and is simply the length (i.e., the number of edges) of a shortest -path in .

For a tree , we denote by the (unique) shortest -path in , and by the subtree of induced by and its descendants when regarding as the tree rooted at . A spider graph (or starlike tree) is a tree having exactly one vertex (called its body) of degree at least . For a spider with body and a vertex , the path is called a leg of . By definition, it is not hard to see that two different legs of have no common vertex. For example, the graph in Figure 1 is a spider with body and legs attached to .

Let be an instance of Shortest Sliding Token. A target assignment from to is simply a bijective mapping . A target assignment is called proper if there exists a -sequence in between and that moves the token on to for every . Given a target assignment from to , one can also define the target assignment from to as follows: for every , . Let be the set of all target assignments from to . We define . Intuitively, observe that any -sequence between and in (if exists) uses at least token-slides.

Let be a -sequence between two independent sets and of a graph . Indeed, one can describe in term of token-slides as follows: , where and () satisfy , , and . The reverse of (which reconfigures to ), denoted by , is defined by . One can also describe in term of token-slides: . For example, the -sequence described in Figure 1 can also be written as . Similarly, .

For an edge , we say that makes detour over if both and are members of . We emphasize that the steps and is not necessarily made by the same token. The number of detours makes over , denoted by , is defined to be twice the minimum between the number of appearances of and the number of appearances of . The total number of detours makes in , denoted by , is defined to be . As an example, one can verify that the -sequence described in Figure 1 satisfies and . Let be the set of all -sequences in between two independent sets . We define by the smallest number of detours that a -sequence between and in can possibly make.

For two -sequences and in a graph , if the sequence of token-slides forms a -sequence in , we define , and say that is obtained by taking the concatenation of and .

## 3 Shortest Sliding Token for spiders

In this section, we show that Shortest Sliding Token for spiders can be solved in polynomial time. More precisely, we claim that

###### Theorem 1.

Given an instance of Shortest Sliding Token for spiders, one can construct a shortest -sequence between and in time, where denotes the number of vertices of the given spider .

First of all, from the linear-time algorithm for solving Sliding Token for trees (which also applies for spiders as well) presented in [6], we can simplify our problem as follows. For an independent set of a tree , the token on is said to be -rigid if for any with , . Intuitively, a -rigid token cannot be moved by any -sequence in . One can find all -rigid tokens in a given tree in linear time. Moreover, a -sequence between and in exists if and only if the -rigid tokens and -rigid tokens are the same, and for any component of the forest obtained from by removing all vertices where -rigid tokens are placed and their neighbors, . Thus, for an instance of Shortest Sliding Token for spiders, we can assume without loss of generality that and there are no -rigid and -rigid tokens.

### 3.1 General idea

We now give a brief overview of our approach. For convenience, from now on, let be an instance of Shortest Sliding Token for spiders satisfying the above assumption. Rough speaking, we aim to construct a -sequence in between and of minimum length , where and are respectively the smallest number of token-slides and the smallest number of detours that a -sequence between and in can possibly perform, as defined in the previous section. Indeed, the following lemma implies that any -sequence in between and must be of length at least .

###### Lemma 2.

Let be two independent sets of a tree such that . Then, for every -sequence between and , .

###### Proof.

Let . Let be a -sequence between and that moves the token on to for some target assignment . For each , let be the sequence of token-slides that moves from to along the (unique) path . Note that is not necessarily a -sequence.

Let consider the movements of from to in the -sequence . First of all, it is clear that needs to make all moves in . Since the path is unique, if makes any move that is not in for some edge , it must also make the move later, hence forming detour over . Let be the number of detours formed by the token-slides in . Clearly, .

The token-slides in may also form detour. Let be such that the sequence moves from to and at some point makes the move , and the sequence moves from to and at some point makes the move . Together, and form detour over an edge . Let be the number of detours formed by such token-slides. Clearly, .

Suppose that for an edge , there exists pairs with , , and for any two pairs and , and () such that for each , the sequence at some point makes the move , and the sequence at some point makes the move . It follows that the vertices and are in , and the vertices and are in . We note that , and emphasize again that and are not necessarily -sequences. Let be the set of all edges of satisfying the described property with respect to the target assignment . Then, .

Let be an edge of as described above. Let be the target assignment defined as follows: for , , , and for . Then, , and . Using this property repeatedly, we can finally find a target assignment such that and .

Therefore, . ∎

As a result, it remains to show that any -sequence in between and must be of length at most , and there exists a specific -sequence in between and whose length is exactly . To this end, we shall analyze the following cases.

• Case 1: .

• Case 2: .

• Case 3: .

In each case, we claim that it is possible to simultaneously determine and construct a -sequence in between and whose length is minimum. More precisely, in Case 1, we show that it is always possible to construct a -sequence between and of length , that is, no detours are required. (Note that, no -sequence can use less than token-slides.) However, this does not hold in Case 2. In this case, we show that in certain conditions, detours cannot be avoided, that is, any -sequence must make detours at least one time at some edge of . More precisely, in such situations, we show that it is possible to construct a -sequence between and of length , that is, the sequence makes detour at exactly one edge. Finally, in Case 3, we show that detours cannot be avoided at all, and it is possible to construct a -sequence between and of minimum length, without even knowing exactly how many detours it performs. As a by-product, we also describe how one can calculate this (smallest) number of detours precisely.

### 3.2 When max{|I∩NG(v)|,|J∩NG(v)|}=0

As mentioned before, in this case, we will describe how to construct a -sequence in between and whose length equals . In general, to construct any -sequence, we need: (1) a target assignment that tells us the final position a token should be moved to (say, a token on should finally be moved to ); and (2) an ordering of tokens that tells us which token should move first. From the definition of , it is natural to require that our target assignment satisfies . As you will see later, such a target assignment exists, and we can always construct one in polynomial time. We also claim that one can efficiently define a total ordering of vertices in such that if and , then the token on will be moved before the token on in our desired -sequence. Combining these results, our desired -sequence will finally be constructed (in polynomial time).

#### Target assignment.

We now describe how to construct a target assignment such that . For convenience, we always assume that the given spider has body and legs . Moreover, we assume without loss of generality that these legs are labeled such that for ; otherwise, we simply re-label them. For each leg (), we define the corresponding independent sets and as follows: ; ; and for , we define and . In this way, we always have (resp. ) if (resp. ). This definition will be helpful when considering tokens placed at the body vertex .

Under the above assumptions, we design Algorithm 1 for constructing as below.

The next lemma says that Algorithm 1 efficiently produces our desired target assignment.

###### Lemma 3.

Let be an instance of Shortest Sliding Token where are independent sets of a spider with body . Let be a target assignment produced from Algorithm 1. Then,

• Algorithm 1 constructs in time; and

• for an arbitrary target assignment , . In other words, satisfies .

Before proving Lemma 3, we prove the following useful lemma.

###### Lemma 4.

Let be an instance of Shortest Sliding Token where are independent sets of a spider with body . Let be a target assignment produced from Algorithm 1. Let be such that . Let be the indices such that , i.e., is assigned before and . Then, .

###### Proof.

If , the desired inequality becomes the famous triangle inequality. Thus, we can assume without loss of generality that .

Based on the possible relative positions of , , , and , we consider the following cases.

• Case 1: and are in .

• Case 1.1: and are in . From Algorithm 1, we always have . Since is assigned before , and , it follows that . (See Figure 2.) We note that the case can be seen as a special case of Cases (a) or (b) in Figure 2. Similarly, the case can be seen as a special case of Cases (b), (c), (d), or (f) in Figure 2; and the case can be seen as a special case of Cases (d) or (e). Similar arguments hold for the next cases.

• Case 1.2: and are in , . (See Figure 3.) From Algorithm 1, we always have . Note that if , Case (a) of Figure 3 does not happen; otherwise, must be assigned before .

• Case 1.3: is in , is in , . Since , , and is assigned before , it follows that . (See Figure 4.)

• Case 1.4: is in , is in , . Since , , and is assigned before , it follows that and , which implies that . (See Figure 5.)

• Case 1.5: is in , , is in , . (See Figure 6.) Note that if , Case (b) of Figure 6 does not happen; otherwise, must be assigned before .

• Case 2: and , .

• Case 2.1: and are in . From Algorithm 1, we always have . (See Figure 7.)

• Case 2.2: and are in , . From Algorithm 1, we always have . Since and , , Algorithm 1 will assign any vertex in to some vertex in , which implies . However, since and , Algorithm 1 must assign before , a contradiction. Thus, this case cannot happen.

• Case 2.3: and are in , . From Algorithm 1, we always have . (See Figure 8.)

• Case 2.4: is in , is in , . (See Figure 9.)

• Case 2.5: is in , is in , . (See Figure 10.)