Next Article in Journal
Optical Medieval Music Recognition Using Background Knowledge
Next Article in Special Issue
Biased-Randomized Discrete-Event Heuristics for Dynamic Optimization with Time Dependencies and Synchronization
Previous Article in Journal
Scale-Free Random SAT Instances
 
 
Order Article Reprints
Font Type:
Arial Georgia Verdana
Font Size:
Aa Aa Aa
Line Spacing:
Column Width:
Background:
Article

Optimal Algorithms for Sorting Permutations with Brooms

1
Department of Computer Science and Applications, Amrita Vishwa Vidyapeetham, Amritapuri 641112, India
2
Department of Computer Science, UT Dallas, Richardson, TX 75080, USA
*
Author to whom correspondence should be addressed.
Algorithms 2022, 15(7), 220; https://doi.org/10.3390/a15070220
Received: 25 May 2022 / Revised: 7 June 2022 / Accepted: 13 June 2022 / Published: 21 June 2022

Abstract

:
Sorting permutations with various operations has applications in genetics and computer interconnection networks where an operation is specified by its generator set. A transposition tree T = ( V , E ) is a spanning tree over n vertices v 1 , v 2 , v n . T denotes an operation in which each edge is a generator. A value assigned to a vertex is called a token or a marker. The markers on vertices u and v can be swapped only if the pair ( u , v ) E . The initial configuration consists of a bijection from the set of vertices v 1 , v 2 , , v n to the set of markers ( 1 , 2 , , n 1 , n ) . The goal is to sort the initial configuration of T, i.e., an input permutation, by applying the minimum number of swaps or moves in T. Computationally tractable optimal algorithms to sort permutations are known only for a few classes of transposition trees. We study a class of transposition trees called a broom and its variation a double broom. A single broom is a tree obtained by joining the centre vertex of a star with one of the two leaf vertices of a path graph. A double broom is an extension of a single broom where the centre vertex of a second star is connected to the terminal vertex of the path in a single broom. We propose a simple and efficient algorithm to obtain an optimal swap sequence to sort permutations with the transposition tree broom and a novel optimal algorithm to sort permutations with a double broom. We also introduce a new class of trees named millipede tree and prove that D * yields a tighter upper bound for sorting permutations with a balanced millipede tree compared to D . Algorithms D * and D are designed previously.

1. Introduction

Sorting permutations with various operations has applications in genetics and computer interconnection networks [1,2,3,4] and is an active field of research.Reversals, transpositions, prefix reversals, prefix transpositions have been extensively studied with respect to upper bounds, lower bounds, exact distances for all permutations in S n etc. Transposition tree is one such operation which has applications in solving puzzles and robot motion planning [5,6].
Hypercube architecture was a golden standard in 1980s for computer interconnection networks. Later, Akers and Krishnamurthy [1] proposed a transposition tree called star, and showed that the Cayley graph corresponding to star, called star graph can accommodate n ! nodes and has diameter sub-logarithmic in number of vertices. Star graphs surpass the then topology Hypercube, both in scalability and diameter because the later can accommodate only 2 n vertices and has diameter logarithmic in number of vertices. Diameter is an important quality of service parameter deciding the latency of interconnection networks [7,8]. There is a natural trade-off between diameter and the cardinality of the generator set. That is, a larger generator set decreases the diameter and vice-versa. The diameter of a Cayley graph Γ , can be trivially reduced to 1 if the degree of each node in Γ is one less than the total number of nodes. However, if the number of symbols, i.e., the label length of a vertex is n, then this would require the degree to be n ! 1 and this is infeasible. Thus, a good balance is sought. In this regard, the degree of Γ generated using any transposition tree is a relatively small value of n 1 and for some trees the diameter can be small as well. For example, for a star graph the diameter is 3 / 2 n + O ( 1 ) [1]. Thus, Cayley networks were established as a better topology than hypercubes for interconnection networks. Cayley networks also possess other desirable features such as vertex symmetry and small diameter [1]. These are detailed in Heydemann [3], Lakshmivarahan et al. [4], and Xu [8].
In this article we study the problem of sorting permutations under the operation specified by specific transposition trees—single broom, double broom and millipede tree. A transposition tree T = ( V , E ) is a spanning tree over n vertices v 1 , v 2 , , v n . T denotes an operation in which each edge is a generator [1]. A value assigned to a vertex is called token or marker. The markers on vertices u and v can be swapped only if the pair ( u , v ) E . This is equivalent to applying the corresponding generator and is referred to as making a move. Since swap is symmetric, the edge ( u , v ) is undirected. The initial configuration consists of a bijection from v 1 , v 2 , v n to ( 1 , 2 , , n 1 , n ) ; i.e., from the set of vertices to the set of markers over the alphabet { 1 , 2 , , n 1 , n } . That is, one can view each vertex v i as an index i in an array where some marker j resides. Thus, input consists of a permutation. The vertex v i is the home for the corresponding marker i and we seek to home all markers with minimum number of moves. Note that if for all i, v i = i then the permutation is sorted. Thus, the goal is to sort the initial configuration, i.e., an input permutation, by applying the minimum number of generators (or swaps or moves) of T. In the remainder of the article, ‘sorting’ refers to transforming a given permutation into the identity permutation with a minimum number of moves of T.
Example 1. 
LetTbe a transposition tree with V = { 1 , 2 , 3 , 4 , 5 } and E = { ( 1 , 2 ) ( 2 , 3 ) ( 3 , 4 ) ( 4 , 5 ) } . The generators are the permutations { ( 21345 ) , ( 13245 ) , ( 12435 ) , ( 12354 ) } .
The computational complexity of sorting permutations with transposition trees is unknown in general. However, computationally tractable optimal algorithms to sort permutations are known for a few classes of transposition trees such as star [1], path [9], broom [5,6,10], etc.
We study the problem of sorting permutations with a single broom and a double broom transposition trees. A broom, also referred to as a single broom, is a transposition tree obtained by joining the center vertex of a star with one of the leaf vertices of a path. Several efficient optimal algorithms are known to sort permutations using a broom [5,10,11]. In Section 3 we design a new efficient optimal algorithm for sorting permutations using single broom. In Section 4 we design a novel efficient optimal algorithm for sorting permutations using double brooms. This algorithm is designed by extending the algorithm for single broom. The problem of sorting permutations using a new class of trees called millipede tree, is studied in Section 5. Section 6 demonstrates the limitation of the proposed algorithms when performed on an n-Broom providing a new direction for future research in the field of sorting permutations using transposition trees.

2. Preliminaries and Background

In this article, we employ the alphabet { 1 , 2 , , n 1 , n } to generate the symmetric group S n . The permutation I = ( 1 , 2 , 3 , 4 , , n 1 , n ) is the identity permutation in S n . An operation G is specified by a generator set that is a subset of S n ; G S n . Each permutation in the generator set is a generator. Let π be a permutation in S n , and σ be a generator. Applying σ on π yields another permutation, say γ S n . We say that σ transforms π into γ . Given two permutations α , β S n , and an operation G , the minimum number of generators of G required to transform α into β is called the distance from α to β under G , denoted by d G ( α , β ) and in general, it is hard to compute the same if the number of generators is two or more [12]. When G is symmetric, then d G ( α , β ) = d G ( β , α ) . If the target permutation is I, then d G ( α , I ) is succinctly denoted as d G ( α ) , which is called the distance of α . Transforming α into I is called as sorting α , and thus d G ( α ) is the number of generators required to sort α parsimoniously. Let g 1 , g 2 , g t be a shortest sequence of generators such that α g 1 g 2 g t = β . Then β 1 α g 1 g 2 g t = β 1 β = I . That is, the number of moves required to transform α into β is same as that of transforming β 1 α into the identity permutation I. Thus, the problem of finding minimum distance between two given permutations reduces to the problem of sorting a related permutation. If the target permutation is I, then d G ( β 1 α , I ) is denoted as d G ( β 1 α ) , which is called the distance of a single permutation β 1 α .
Various operations have been studied in the past. Some of them are reversal, transposition, block interchange, etc. A block move operation moves a block; e.g., block transposition, suffix block transposition etc. A small sample of the research in this broad area follows. Christie studied sorting permutations by transpositions and proved a tighter lower bound based on the hurdles of the underlying cycle graph and designed a simpler 3/2-approximation algorithm [13]. The first non-trivial lower and upper bounds for prefix transposition distance over permutations were given in [2]. Chitturi et al. [14] shows how to compute the transposition distances of all permutations in S n in an amortized time of O ( n 3 ) . Recently, subsets of permutations related to a certain type of block move operation have been counted [15]. These results are varied in type that employ distinct techniques such as dynamic programming and applications of graph properties, and constructs such as cycle graphs and adjacencies in permutations.
A Cayley graph Γ T under the operation T over S n is defined as follows. The vertex set V of Γ T consists of all permutations in S n . There is an edge from vertex u to vertex v if there is a generator g T such that u g = v . The distance between two permutations α , and β under the operation T, d T ( α , β ) is equal to the number of edges in the shortest path between the corresponding vertices in Γ T . The diameter of Γ T , D T ( n ) = m a x u , v S n d T ( u , v ) . A transposition tree in turn gives rise to a Cayley graph (refer Figure 1).
The problem of sorting permutations using transposition trees is also known as token swapping on trees [5,6,11,16,17,18,19]. Given a tree T consisting of n vertices { v 1 , v 2 , v n } and edge set E, a configuration of T is an assignment of n distinct markers or tokens { 1 , 2 n } to the vertices of T. Tokens can be moved along the tree edges only. Given an initial configuration f i and a target configuration f t of a tree T, token swapping problem is to transform T from f i to f t with minimum number of moves.
A transposition tree with vertex set { v 1 , v 2 v n } and edge set { ( v 1 , v 2 ) , ( v 2 , v 3 ) ( v n 1 , v n ) } is called a path of length n. An optimal algorithm for sorting permutations using path requires k moves where k is the number of inversions in the given permutation [20]. The reverse permutation ( n , n 1 , n 2 1 ) is the diametral permutation of S n that requires n ( n 1 ) / 2 moves to sort. Another transposition tree studied in the past is star. A star (with center, say v 1 ) is a transposition tree with vertex set { v 1 , v 2 v n } and edge set { ( v 1 , v 2 ) , ( v 1 , v 3 ) ( v 1 , v n ) } . Efficient optimal algorithms for sorting permutations using a star are known [1,21,22]. The optimum number of moves required to sort permutations using star is m + c , where m is the number of un-homed leaf markers, and c is the number of permutation cycles of length 2 , in the given permutation, consisting of un-homed leaf markers only [5]. When all cycles in a given permutation are of length 2, it takes the maximum number of moves to sort that permutation. Thus, the diameter of star graph is 3 / 2 ( n 1 ) [1].
Generic algorithms to compute upper bounds (not necessarily tight) for sorting permutations with any given transposition tree have been studied. Akers and Krishnamurthy [1] propose the first known such algorithm that require exponential running time. Ganesan [23] proposed a method to compute an upper bound β m a x in exponential time which is an estimate of the upper bound by analyzing the structure of the transposition tree. Chitturi [24] designed two polynomial (O ( n 2 ) ) time algorithms, γ and δ for computing upper bounds. The cumulative sum of upper bound values of γ and δ for all trees of a particular size were found to be tighter than the values provided by earlier methods. Furthermore, these algorithms solely analyzed the structure of the tree and were computationally efficient. Kraft [25] proposed randomized algorithms with polynomial running time which were looser than the other upper bounds. Uthan and Chitturi define a class of trees called S m , k  [26] and prove an exact upper bound for the same.

3. Sorting Permutations with a Single Broom

In this section, we design a polynomial time optimal algorithm for sorting permutations using a single broom. A single broom is a tree obtained by joining the center vertex of a star with one of the two leaf vertices of a path graph, using a new edge. A single broom has n vertices, partitioned into two sets called star vertices v 1 , v 2 , , v k , and path vertices v k + 1 , , v n , where 2 k ( n 3 ) . Note that the center of the star, i.e., v k + 1 is also a path node. Similarly, markers are partitioned into two sets called star markers and path markers. A star marker is a marker whose home is a star node, and a path marker is a marker whose home is a path node. A new efficient optimal algorithm called A b , for sorting permutations using single broom is given in Section 3.1.

3.1. Algorithm A b

Let S m i n be the star marker that is closest to its home residing on the path and P m a x be the largest path marker that is not homed. Our algorithm A b for single broom that transforms a given input configuration to a sorted configuration, consists of the following 3 steps in the given order.
  • While (∃ a S m i n ), efficiently home S m i n ;
  • While (∃ a P m a x ), efficiently home P m a x ;
  • Efficiently home the markers in the star that need to be homed.
An illustration of algorithm A b for a single broom is given in Figure 2. In the initial setup, we have two unhomed star markers on path, i.e., 3 on v 7 and 2 on v 8 . S m i n is 3 in the first iteration and in the next it will be 2. Homing markers 3 and 2 take 5 swaps in total. Then, there will be no star markers residing on the path. Thus, we can start with Step 2 of our algorithm. P m a x is 8 and a swap with 7 homes both the markers. Only the star markers 5 and 4 at v 4 and v 5 respectively need to be homed. Our algorithm homes all markers in total of 9 swaps, exactly the same number of swaps that are taken by the algorithms of Biniaz et al. [5], Yamanaka et al. [6] and Vaughan [10].
Step 1 and Step 2 of A b have the following properties:
  • Star markers residing on the path always move to the left in the increasing order of their distances from their respective homes;
  • A path marker moves right to its home; thereby moving the smaller path markers towards the center;
  • Swap involving two star markers will not take place on a path edge.
The next section covers the analysis and correctness proof of the algorithm A b .

3.2. Analysis of A b

We begin our analysis for the number of swaps with Step 1. Let D ( S p ) be the distance from S p to its home, where S p are the star markers residing on the path of the broom. S p , can reside either on the central node or on the rest of the nodes in the path. Note that homing a marker from central node to a star leaf takes exactly a single swap. W s is the total number of swaps executed in Step 1. Since, we home the nearest markers first, the distances of the markers that are homed subsequently do not increase. Thus, we have the following expression.
W s = S p D ( S p ) .
Observe that for Step 2, we are now left only with the path containing path markers. The total moves required on the path to place the markers at their desirable vertices is same as the number of inversions [9,27,28]. Let D ( P p ) be the distance from the path marker P p to its home, where P p is the path marker residing on the path of the broom. W p is the total number of swaps executed in Step 2. Then, for the reason stated for W s in Step 1,
W p = P p D ( P p ) .
For the final step in A b , let L S be the number of permutation cycles not containing the center vertex that have a length ≥ 2 and N S be the number of markers in these cycles. These markers are not swapped in Step 1 or Step 2. So, as discussed before in Section 2, the number of swaps to home the star markers is L S + N S .
W b , the total number of swaps performed in A b is:
W b = P p D ( P p ) + S p D ( S p ) + L S + N S .
Step 1 of A b takes a distance-based approach in which S m i n is selected on the basis of its distance from the leaf nodes in the star. Step 2 obeys a value-based approach in which a maximum valued path marker is homed first. Biniaz’s, Kawahara’s and Vaughan’s algorithms are strictly based on a value-based approach and work in O ( n 2 ) time. Figure 3 compares the traversal of markers in A b with the algorithms proposed by Biniaz and Kawahara.
Time complexity of A b can be expressed in terms of number of moves. The total number of S m i n markers possible in Step 1 is m i n ( S , P ) where S is the number of star vertices and P is the number of path vertices. The worst case of this step occurs when all the path nodes are occupied by star markers and the homes of these star markers are occupied by other star markers. The total number of moves required in Step 1 is ( P ( P + 1 ) / 2 ) + ( S P ) . The worst case of Step 2 occurs when all P path markers need to be homed with a total swap count of P ( P 1 ) / 2 . Solving the star in step 3 requires a maximum of 3 S / 2 moves. Since P , S O ( n ) , Algorithm A b runs in O ( n 2 ) time.
As the number of edges in a single broom is n 1 , the tree requires O ( n ) space, and the algorithm does not require any additional space.

3.3. Correctness of A b

In this section, we prove that A b finds an optimal swap sequence, S o p t , which always follows some interesting properties. To show that, S o p t is optimal, we first prove that these properties hold for a given marker on a broom and then apply induction on n.
Lemma 1.
An optimal path sequence S o p t will obey following properties:
  • A pair of markers swap at most once.
    Proof. 
    We prove it using contradiction. Suppose the swap sequence S = S 1 , S 2 , S 3 S s , contains the swap of ( x , y ) twice at S i and S j . Modify S by deleting S i and S j . Then, for each swap S k where i < k < j , replace x with y and vice-versa. Resulting swap sequence is shorter and achieves the same results.    □
  • Star markers that enter the star from path do so in the increasing order of their distance from center.
    Proof. 
    Consider two star markers x and y residing on the path. Assume x and y are at a distance d and d + c respectively from their home. Let S be the swap sequence containing the swap S i which swaps y and x on the path. Marker y will be homed after a swap with the marker residing on its home H y , call this swap S j where j > i . Similarly x will be homed after a final swap S k with H x where k > j . Call this intermediate configuration of markers as S . We show how S can be modified in order to obtain an optimal sequence. To modify S, omit S i and carry out further swaps with x & y and H x & H y exchanged, until the swap S k . Observe that we have obtained the same marker configuration as in S but with fewer swaps.    □
  • Two star markers will never swap on a path edge.
    Proof. 
    Let us take x and y to be the star markers that swap on the path edge in S. We show how S can be modified to obtain a swap sequence with a lesser number of swaps on the path. After the swap of x and y in S, at some point of time, both x and y will get into the star. Let S be a sub sequence of S, where y resides on a star leaf and x on the center node. To modify S, remove the swap of x and y and replace x with y and vice versa for the following swaps. Iterate this till the point S is reached in S and add a swap of x and y. We have achieved the same target state, but a swap carried out on the path is removed and compensated by adding an additional swap in the star.    □
    To illustrate the same, consider the swap sequence S = ( 1 , 2 ) , ( 2 , 6 ) , ( 2 , 3 ) , ( 1 , 6 ) , ( 1 , 3 ) , ( 1 , 4 ) . Note that S = ( 1 , 2 ) , ( 2 , 6 ) , ( 2 , 3 ) , ( 1 , 6 ) , ( 1 , 3 ) , where we have 2 at star leaf (say x) and 1 at the center (say y).
    If we omit the swap move (1, 2) and exchange x = 1 , y = 2 we get the modified swap sequence as ( 1 , 6 ) , ( 1 , 3 ) , ( 2 , 6 ) , ( 2 , 3 ) (refer Figure 4). Followed by a swap move of x and y we achieve the same configuration as S but the swap of x and y on path edge is replaced by a swap on star edge, resulting in lesser swaps on path edges.
  • In every swap on the path edge involving at least one path marker, the larger of the markers will move to the right.
    Proof. 
    Considering the contradiction of the stated property, a bad swap involves moving a smaller valued path marker to the right and larger valued path marker to the left. Suppose S contains a bad swap. We show how S can be modified to obtain a new swap sequence which contains fewer swaps on the path. Assume smaller marker s is swapped to the right and larger marker l to the left. Property 1 restricts us from directly swapping them again. Therefore, marker l will move to the star leaf, then marker s to another star leaf and then l goes to the center of the star. Let us call this intermediate placement as S . Now, to modify S, remove the swap of s and l, and continue with the preceding swaps with s and l exchanged until the state S is reached. We have achieved the same target state, but a swap carried out on the path is removed and compensated for by adding an additional swap in the star; hence, reducing the swap count on the path edge.    □
  • No star marker moves past the first path edge from left to right.
    Proof. 
    Let S include a swap S i in which a maker x moves past the first path edge to the right using a swap with a marker p. Let, S j is a swap belonging to S where j > i which results in x reentering the star with the help of a swap with q. Taking the least possible j into account, we first establish that the marker q was residing on the star leaf during S i . Suppose q was on path node during S i , then q will lie on the right to x. Swaps involving x between S i and S j will only keep it on path nodes and not move it past the first path edge as per our assumption. Marker q is restricted to swap twice with x on the path edge as per Property 1, which proves that q lies on the right of x during S j , which is contradictory. We show how S can be modified to obtain a swap sequence with a lesser number of swaps on the path. Before S i , carry out a swap of x and q and continue with the following swaps till S j 1 with x replaced with y and vice-versa. We have achieved the same target state but the swap on a path edge is removed and replaced by a swap on a star edge, hence reducing the number of swaps on the path edge.    □
Theorem 1.
Algorithm A b computes an optimal swap sequence, i.e., a sorting sequence with the least possible number of swaps.
Proof. 
We prove that our algorithm obtains an optimal swap sequence by applying induction on marker n. The base case is just a star S. Depending on the position of S m i n and P m a x , we consider different cases and prove them individually. Moreover, for the general induction step, we prove that swaps performed by S m i n and P m a x are a part of an optimal swap sequence.
Case (1): The initial position of S m i n is any path vertex other than the center vertex. Let S o p t be the optimal swap sequence. Property 2 and Property 3 ensures that n will never encounter a star marker on the path and hence it will only swap path markers on its way home. Let d be the distance from the initial position of marker n to its home vertex H n . So, S o p t contains d swaps which involves marker n. Let S i be the swap that homes marker n, therefore S 1 , S 2 , , S i contain d swaps which includes marker n and ( i d ) swaps that do not include marker n. Call this intermediate configuration T. Create a separate swap sequence S o p t which homes n in first d swaps followed by i d swaps that do not involve n and then carry on with rest of the swaps from S i + 1 , , S k . Homing marker n does not alter the relative order of the remaining markers. Clearly, we have attained the same configuration state as in T, implying S o p t is an optimal swap sequence which is generated by our algorithm A b .
Consider S be an optimal swap sequence which brings n to the center vertex. Observe that n can be placed on center in exactly d 1 swaps, where d is the distance of n from its home vertex H n on the star leaf. Let S c be the swap in S = S 1 , S 2 , , S c that places marker n on the center and T be the intermediate configuration of the markers after S c . Create a swap sequence S that homes the marker n first in d 1 swaps and carries out the rest of the c ( k 1 ) swaps, which does not include n. Clearly, you will get the same resulting configuration as of T with the same number of swaps. Hence, S is an optimal swap sequence.
Now, call S h the swap that homes n from the center vertex by swapping it with an arbitrary marker t residing on H n . Aforementioned discussion assumes that no swaps which involve star edges occur before S h . Otherwise, when n is initially placed on the center vertex or arrives at the center with the swap S c , it suffices to show that S o p t is optimal which does not alter the position of n before the swap S h . We do some modifications in S o p t to make this true. Split the subsequence S 1 , S 2 , , S h 1 into S p a t h and S s t a r , where the subsequence S p a t h contains the swaps that occur on path edges and the subsequence S s t a r contains the swaps that occur on star edges. Note that S p a t h does not move marker n from its position and S s t a r always places n back to the center. We can rearrange this subsequence containing S s t a r and S p a t h as there are no star markers moving towards the path and vice versa as mentioned in Property 5. After S p a t h , carry out the swap S h and then perform the swaps in S s t a r but with t and n exchanged. This results in the same placement of markers with no change in the swap count on the star and path. Hence, S o p t is same as the optimal sequence generated by our algorithm A b .
Case (2): After Step 1 of A b , it is important to observe that we are now only left with path markers as all the star markers are either homed or residing on star nodes (will be homed in Step 3). So, lets consider marker n = P m a x is on a path vertex, except the center vertex. According to the property proved before, P m a x will always move to the right, swapping the lesser value marker to the left. Let S be the swap sequence which contains swap moves for homing P m a x . Consider S h to be the swap which slots P m a x in its home and T be the configuration at that instance. Considering distance d between P m a x and its home, we can say S 1 S h will have d swaps involving P m a x and ( i d ) not involving P m a x (say S be that swap sequence). To modify S, we first make d swap moves which involve P m a x , followed by S and then S i + 1 S f i n a l , call this swap sequence S o . It is interesting to observe that initial d swap moves will not change the relative order of the rest of the path markers, post which, S swap moves can be performed, ultimately resulting in the same configuration T; hence S o is optimal.
Now, suppose n = P m a x is on the center vertex. Let S p be the swap that marker n on the first path edge e = ( v k + 1 , v k + 2 ) with an arbitrary marker t. If we assume there are no swaps before S p , we can just prove it with the above mentioned discussion in Case 2. Else, it suffices to show that S o p t is optimal and does not alter the position of n before S p . We modify S o p t to make this true. Split the subsequence S 1 , S 2 , , S p 1 into S p a t h and S s t a r , where S p a t h contains the swaps that occur on path edges and S s t a r contains the swaps that occur on star edges. Note that S p a t h does not move marker n from its position and S s t a r always places n back to the center. Additionally, as per Property 5 we can rearrange the subsequence containing S s t a r and S p a t h as there are no star markers moving towards the path and vice versa. To rearrange this subsequence, perform the swaps in S p a t h , then the swap S p followed by the swaps in S s t a r . While performing the saps in S s t a r replace the marker n with marker t. This results in same placement of markers with no change in the swap count on the star and path edges; hence, S o p t is optimal and is the same as the one generated by our algorithm A b .
Case (3): As discussed before, for Step 3 the optimal number of swaps are L S + N S where L S be the number of permutations that have a length ≥ 2 not involving the center vertex (say V c ) and N S be the number of markers that are in these permutations. In case of star, consider a sequence P of length ≥ 2 and the star vertices (say V s ). If V c P , then the total swap count to sort P is V s + 1 . If V c P , then the total swap count is V s . As the cycles in L S are not related to each other, L S + N S gives the optimal swap count.    □

4. Sorting Permutations with a Double Broom

A novel polynomial algorithm A d b is designed in this section for optimally sorting permutations using a double broom. A double broom is a double star with their central vertices joined with a path (also known as a stem) [24]. Suppose double broom has a total of n vertices, v 1 , v 2 , , v i on the left star, v i + 1 , , v j residing on the path (or stem) and v j + 1 , , v n on the right star. Note that we consider the central vertices v i + 1 and v j of the stars as path vertices of the double broom.
Let S L and S R be the left and right stars respectively, with corresponding center vertices C L and C R . Let S m i n R and S m i n L be the closest star marker residing on the path to S R and S L respectively and P m a x be the maximum valued unhomed path marker.
Our algorithm A d b , that transforms a given input configuration to a sorted configuration, is as follows:
  • While ∃ a S m i n R marker, efficiently home S m i n R ;
  • While ∃ a S m i n L marker, efficiently home S m i n L ;
  • (At this point, only the stem is left) While ∃ a P m a x marker, efficiently home P m a x ;
  • Efficiently home the markers of S R and S L .
Note that any vertex to the right of C L (inclusive) will be considered as a path vertex from the perspective of a marker residing in S L . Similarly, any marker to the left of C R (including) will be a path vertex for markers in S R .
Our algorithm places each marker at its respective vertex in 10 swaps (refer Figure 5). It is also noteworthy to mention that the happy leaves are swapped in the process, hence abiding to the Happy Leaves conjecture. A d b obeys following interesting properties which we use to analyse the algorithm in the next section.
  • Swap of two star markers belonging to a same star will never take place on a path edge;
  • Stem marker moves right to its home, swapping smaller markers to the left.

4.1. Analysis of A d b

Let T d b be the total number of swaps performed in A d b . We first consider step 4 of our algorithm. For S L , let C N T S L be the non trivial cycles and n S S L be the number of markers in these cycles. Similarly, for S R , let C N T S R be the non trivial cycles and n S S R be the number of markers in these cycles. As these markers retain their relative positions till Step 4 of our algorithm, our total number of swaps T S R , S L in Step 4 will be:
T S R , S L = C N T S L + n S S L + C N T S R + n S S R .
Let T R and T L be the total number of swaps carried out in Step 1 and Step 2 respectively. To analyse T R and T L , we allocate each of its swaps to closest star marker residing on the path and involved in the swap. Then,
T R = S m i n R T ( S m i n R ) ,
where T ( S m i n R ) is the number of swaps allocated to closest star marker S m i n R . For S m i n R , define D ( S m i n R ) to be the distance from a star leaf to S m i n R ’s home. With reference to the initial configuration state of the markers, let R ( S m i n R ) be the number of markers smaller than S m i n R and on the right of S m i n R .
T L = S m i n L T ( S m i n L ) .
Similarly, for S m i n L , define D ( S m i n L ) to be the distance from a star leaf to S m i n L ’s home and let L ( S m i n R ) be the number of markers greater than S m i n L and on the right of S m i n L .
Claim 1. 
T ( S m i n R ) is the minimum of D ( S m i n R ) and R ( S m i n R ) .
Proof. 
If T ( S m i n R ) or S m i n L are at star leaf of S L or S R respectively in the current configuration of markers, we can say T ( S m i n R ) = D ( S m i n R ) implying D ( S m i n R ) R ( S m i n R ) . T ( S m i n R ) = D ( S m i n R ) , where D ( S m i n L ) L ( S m i n L ) and thus validating our claims.    □
Claim 2. 
T ( S m i n L ) is the minimum of D ( S m i n L ) and L ( S m i n L ) .
Proof. 
If S m i n R is not at a star leaf of S L , we can say R ( S m i n R ) < D ( S m i n L ) . Similarly, in case of S m i n L , L ( S m i n L ) < D ( S m i n L ) , justifying the above mentioned claims.    □
Claim 3. 
In algorithm A d b , swapping Steps 1 and 2 does not alter the swap count.
Proof. 
In the initial configuration, let S L R and S P R to be the number of star markers residing in S L and on the path, respectively, whose homes are in S R . Similarly, let S R L and S P L be the number of star markers residing in S R and on the path respectively whose homes are in S L . Path markers can be in S L , S R , or on the path. Let the total swaps required for homing path markers be P = P P + P R + P L , where P P , P R , and let P L be the swap count for homing markers residing on the path, S R and S L respectively.
Case (1): Perform Step 1 of A d b followed by Step 2. Moving S m i n R towards the right, shifts the markers it encounters on the way to the left. This shift decreases S R L and S P L . Path markers entering into S L (say P L ) during a swap increase P and the number of path tokens leaving S R , i.e., P R will result in the decrease of P.
T R + ( T L ( S R L + k ) ) + ( P + P L P R ) , where 0 k S P R .
In Step 2, S m i n L can encounter only path markers on the way home. S m i n L shifts both P L markers which entered into S L in Step 1 and P L markers to the right.
( T L ( S R L + k ) ) + ( ( P + P L P R ) ( P L + P L ) ) .
At this point, we are now left only with P P as all the path markers are now residing on the path, for which the swap count will be the total number of inversions.
Case (2): Perform Step 2 of A d b followed by Step 1. Moving S m i n L towards the left, shifts the markers it encounters on the way to the right. This shift decreases S L R and S P R . Path markers entering into S R (say P R ) during a swap increase P and the number of path tokens leaving S L i.e., P L will result in the decrease of P.
T L + ( T R ( S L R + k ) ) + ( P + P R P L ) , where 0 k S P L .
In Step 2, S m i n R can encounter only path markers on the way home. S m i n R shifts both P R markers which entered into S R in Step 1 and P R markers to the left.
( T R ( S L R + k ) ) + ( ( P + P R P L ) ( P R + P R ) ) .
At this point, we are now left only with P P , the same as what we arrived at in Case 1. Markers traversing towards S R in Step 1 of A d b shift all the markers whose home is in S L to the left. Similarly, markers traversing towards S L shift all markers to the right; hence, there are no bad swaps and the properties of A d b are obeyed.    □
In Step 3, observe that we are now left only with the stem markers. The total number of swaps on path are the same as the number of inversions required to place the markers at their desirable vertex. Let D ( P m a x ) be the distance from the marker P m a x to its home. Similarly, we can say:
T P m a x = P m a x D ( P m a x ) ,
where T P m a x are the total number of swaps in Step 3 and P m a x are the markers residing on the stem of the broom.
Lemma 2.
T d b = T S R , S L + T ( S m i n R ) + T ( S m i n L ) + P m a x D ( P m a x ) .
Similar to algorithm A b , time complexity of A d b is also expressed in terms of the number of moves. The worst case of Step 1 occurs when all path vertices are occupied by star markers of S R and the homes of these star markers are occupied by other S R markers. The total number of moves required in this case is ( P ( P + 1 ) / 2 ) + ( S L > R ) ( P + 1 ) + ( S 1 P ) , where S 1 and P are the number of vertices in S R and path respectively. The worst case of Step 2 occurs when all the path vertices are occupied by star markers of S L and the homes of these star markers are occupied by other S L markers. The total number of moves required in this case is ( P ( P + 1 ) / 2 ) + ( S 2 P ) , where S 2 is the number of vertices in S L . In the worst case of Step 3, P ( P 1 ) / 2 moves are required to home the P path markers. Step 4 requires 3 S 1 / 2 + 3 S 2 / 2 moves at most. Since P , S O ( n ) , Algorithm A d b runs in O ( n 2 ) time. The tree requires O ( n ) space, and the algorithm does not require any additional space.

4.2. Correctness of A d b

In this section, we prove that our algorithm A d b generates an optimal swap sequence on a double broom. Initially, we discuss some properties required to prove the correctness of our algorithm. Section 1 covers the proof for properties 1 to 5.
  • Two same markers will not swap more than once;
  • Star markers belonging to the respective star enter into the star in the increasing order of their distances from that star;
  • Star markers belonging to the respective star never swap with each other on the path edges. Note that the star marker belonging to S L treats the edges of the S R as path edges and vice-versa;
  • Swaps on the stem involving at least one stem marker—the larger of the markers will move to the right’
  • No star marker residing on one if its star vertices moves past the first path edge;
  • In a swap s = ( l , r ) where l S L and r S R , l always moves to the left and r to the right.
Proof 
We prove it by contradiction. A b a d s w a p involves moving l to the right and r to the left. Suppose S has a b a d s w a p on the path. We show how S can be modified to obtain a new swap sequence which contains fewer swaps on the path. Property 1 restricts us from directly swapping them again. Therefore, marker r will move to the star leaf of S L (or l will move to the star leaf of S R ), then marker l to another star leaf of S L (or r will move to another star leaf of S R ) and then l goes to the center of S l (or r will move to the center of S R ). Let us call this intermediate placement of markers S . To modify S, omit the swap of l and r, and carry on with the preceding swaps with l and r exchanged until the state S is reached. This results in the same swap count, though a swap on star replaces a swap on path.    □
Theorem 2.
Algorithm A d b generates an optimal swap sequence, i.e., a sorting sequence with the least possible number of swaps.
Proof. 
We prove that our algorithm obtains an optimal swap sequence by applying induction on marker n. For the base case, the double broom has no path edges and it is only a star (either S R or S L ). It is interesting to note that, this algorithm A d b is equivalent to writing:
  • While ∃ a S m i n R marker, home S m i n R .
  • Run A d b
  • Solve S R
As discussed in the previous section, A b obtains an optimal solution and we are now left to prove only in case of S m i n R . Depending on the position of S m i n R , we consider different cases and prove them individually. In the general induction step, we prove that swaps performed by S m i n R are part of the optimal swap sequence.
Case (1): Assume marker n = S m i n R is initially placed on a stem vertex, except the center node of S R . Let P o p t be the optimal swap sequence. Property 2 and Property 3 ensures that n will never swap with a star marker on its way home in S R . Let d be the distance from the position of marker n to its home H n . So, there are exactly d swaps in P o p t which contain marker n. Let S i be the swap that homes marker n, therefore S 1 , S 2 , , S i contain d swaps which includes marker n and ( i d ) swaps that do not include marker n. Let this intermediate configuration be T. Create a separate swap sequence P o p t which takes the initial d swaps to homes n, followed by i d swaps that do not involve n and then carry on with rest of the swaps from S i + 1 , , S k . Initial d swaps leave the remaining markers in the same relative order. We have attained the same configuration state as in T implying the swap sequence P o p t is optimal and is same as the one generated by our algorithm A d b .
Case (2): Consider S be an optimal swap sequence which brings n to the center vertex. Observe that n can be placed on center in exactly d 1 swaps, where d is the distance of n from its home vertex H n on the star leaf. Let S c be the swap in S = S 1 , S 2 , , S c that places marker n on the center and T be the intermediate configuration of the markers after S c . Create a swap sequence S that homes n first in d 1 swaps and carries out the rest of the c ( k 1 ) swaps which does not include n. Clearly, you will get the same resulting configuration as of T with the same number of swaps. Hence, S is an optimal swap sequence.
Now, call S h the swap that homes n from the center vertex of S R by swapping it with an arbitrary marker t residing on H n . Previous discussion assumes that no swaps occur on the star edges before S h . Otherwise, when n is initially placed on the center vertex or arrives at the center with the swap S c it suffices to show that S o p t is optimal and does not alter the position of n before the swap S h . We do some modifications in S o p t to make this true. Split the subsequence S 1 , S 2 , , S h 1 into two subsequences S p a t h and S s t a r . S p a t h contains the swaps that occurs on path edges and S s t a r contains the swaps that occurs on star edges. Note that S p a t h does not move marker n from its position and S s t a r always places n back to the center. We can rearrange this subsequence containing S s t a r and S p a t h as no star markers move towards the path and vice versa, due to the aforementioned Property 5. After S p a t h , carry out the swap S h and then perform the swaps in S s t a r but with t in place of n. Note that we can use the same argument for n placed on S L and prove the optimality of the subsequence as in Case 1. Clearly, this gives the same placement of markers with same swap count on the star and path. Hence, S o p t is optimal and is same as the sequence generated by our algorithm A d b .
Case (3): Assume n = S m i n R is on the leaf vertex of S L . Let t be the marker on the center vertex and S h be the swap involving n and t. If there are no swaps before S h , then just perform S h and use the argument from Case 2 to prove the optimality of the sequence P o p t . Otherwise, suppose there exists a cyclic permutation P s of length L s 1 for the markers residing in S L . Cycles which do not include n are not taken into consideration, as solving those cycles will not alter the position of n. Similar to the argument used for star, we prove that the P s can be solved in L s swaps. Each marker in C is far away by two swaps from its home, so the total distance is 2 ( L s 1 ) . However, as one swap helps us move two markers near to their respective homes, our requirement is only L s 1 swaps. Interestingly, the initial and the final swap of P s moves only one marker which belongs to P s . Adding the swap of n and t results in a total of L s + 1 swaps contradictory to L s 1 swaps to sort P s .    □

5. Analysis of Algorithm D* on Millipede Tree

The first known upper bound f ( Γ ) , for sorting permutations using transposition trees, was computed by Akers and Krishnamurthy [1] in 1989. The time complexity for calculating f ( Γ ) is Ω ( n ! n 2 ) , since it performs pair wise distance computation of each of the possible n ! permutations. Subsequently, various polynomial time approximation algorithms were designed [23,24,25,29,30]. Chitturi introduced algorithm D in [24] which finds the upper bound δ in polynomial time, which is the tightest known upper bound when the upper bounds of all trees are summed together. Subsequently, algorithm D * which identifies corresponding the upper bound δ * was designed in [29]. It was shown that δ * is tighter for balanced-starburst tree [29]. In [31], an analysis of both D and D * was performed and shows that δ * is tighter for full binary tree too. In this section we define a class of trees called millipede tree for which δ * is tighter, compared to δ .
A millipede tree  M k is obtained by connecting the centre vertices c 1 , c 2 , c k of k path graphs p 1 , p 2 , p k arranged in the order, such that k is odd and the number of vertices in p i is given by the following function:
n ( p i ) = 2 i + 1 if 1 i k / 2 2 ( k i ) + 3 Otherwise .
The diameter of M k is ( k + 1 ) and the total number of vertices n = 2 [ k / 2 ( k / 2 + 1 ) ] 1 . v c = c ( k + 1 ) / 2 is the center of the tree. The center has an eccentricity of ( k + 1 ) / 2 .
We call the subtree above the vertex v c the upper millipede tree and the subtree below v c the lower millipede tree(refer Figure 6).

5.1. Algorithm D *

Throughout this section, we employ the terminology used in [1,24,29]. The eccentricity of a node u in V T , denoted by e c c ( u ) , is equal to the maximum value of the distance between u and any other node v V T . The Center of a tree is a node with minimum eccentricity. The Diameter of T denoted as d i a m ( T ) is the maximum among all the eccentricities. The set of vertices in V T with maximum eccentricity is defined as S. S is a subset of the leaf nodes. Algorithm D deletes a set of leaf nodes L V T , and calculates the upper bound required to home markers destined to the vertices in L. This process is continued till the graph becomes a star. The exact upper bound for a star is defined in [1], which is 3 ( n 1 ) / 2 . Let S be divided into kclusters C 1 , C 2 , C k such that for any u , v in C i , i = 1 k d T ( u , v ) < d i a m ( T ) . Let X be any one of the k clusters. When the vertices of S X are deleted, then the diameter of the resultant tree decreases by one. The maximum distance a marker need to travel to be homed is the diameter of the tree, d i a m ( T ) . Thus, D deletes all the vertices of S, except the largest cluster C * , so that minimum number of markers are homed at the current diameter and then reduces the diameter by one. Since the markers homed to the leaves are not required to move further, algorithm D deletes such leaves from the tree. Two variants of D , named D v 1 and D v 2 were introduced. D v 1 removes the entire set S if | C | > 2 3 | S | and D v 2 removes S if | C | 2 3 | S | , where C = S C * . D * , which calculates the upper bound δ *  [29] is an improved version of D . If | S C * | > | C * | , then at most | C * | markers need d i a m ( T ) moves each to be homed. Algorithm D * works based on this idea. The proof can be seen in [29,31]. D * deletes | C * | nodes in d i a m ( T ) cost and the remaining nodes in the cluster with ( d i a m ( T ) 1 / 2 ) cost. It is observed that the δ * is tighter than δ when | C * | is between one-third and half of the total size of set | S | .

5.2. Analysis and Results

It is observed that D * would yield a tighter upper bound than D for a millipede tree. In the first iteration of D * on M k , the set S contains all the leaf nodes and results in two clusters— C 1 and C 2 . C 1 and C 4 are of same size which contain the leaf nodes in the upper and lower millipede trees respectively (refer Figure 7). The terminal nodes in the path graph p ( k + 1 ) / 2 are not part of any cluster. Note that, deleting C 1 or C 2 will result in isomorphic trees (refer Figure 8). Since the size of the largest cluster C * ( C 1 or C 2 ) is less than half of the size of S, only | C * | markers need to be homed in d i a m ( T ) cost and the remaining markers in the set S can be homed at a cost of ( d i a m ( T ) 1 / 2 ) . This results in two steps x 1 and x 2 for calculating the total cost in the iteration:
x 1 : δ * = d i a m ( T ) | C * |
; x 2 : δ * = ( d i a m ( T ) 1 / 2 ) | C C * | .
Algorithm 1 Algorithm D * [29]
  1:
δ * 0
  2:
ifT is a star then
  3:
     δ * δ * + 3 / 2 ( | V T | 1 ) and terminate.
  4:
end if
  5:
Identify S, the set of vertices with maximum eccentricity.
  6:
Compute clusters for S.
  7:
Identify C = S C * where | C * | is the max. If there are multiple such clusters, choose the one with minimum distance sum.
  8:
Case 1: | C * | | S | / 2
  9:
δ * δ * + | C | d i a m ( T ) T T V C
10:
End Case 1
11:
Case 2: | C * | < | S | / 2 // | C | | C * |
12:
δ * δ * + | C * | d i a m ( T ) ; T T V C
13:
if | C | | C * | is even then
14:
     δ * δ * + ( | C | | C * | ) ( d i a m ( T ) 1 / 2 ) ;
15:
else
16:
     δ * δ * + ( | C | | C * | ) ( d i a m ( T ) 1 / 2 ) 1 / 2 ;
17:
end if
18:
End Case 2
19:
ifT is not a star graph then go to step 5.
20:
else
21:
     δ * δ * + 3 / 2 ( | V T | 1 ) and terminate.
22:
end if
In the case of D , there is only one step and all the markers of C are homed in d i a m ( T ) cost. Two nodes are homed in Step x 2 resulting in an improvement of 1 in δ * . As D * and D delete all the vertices of S C * , the resultant tree after the first iteration is same for both. Similarly, every odd iteration generate two clusters and result in an improvement of 1. The second iteration generates two clusters C 1 and C 2 , which contain the leaf nodes of the upper and lower millipede trees respectively. Even iterations do not result in any improvement in δ * , as both the algorithms remove | C | nodes in d i a m ( T ) cost. Refer Table 1, where D C ( C * ) is the cost per node for homing | C * | nodes in Algorithm D , D C ( S C * ) is the cost per node for homing | S C * | nodes in Algorithm D , D * C ( C * ) is the cost per node for homing | C * | nodes in Algorithm D * and D * C ( S C * ) is the cost per node for homing | S C * | nodes in Algorithm D * . After ( k 1 ) iterations in M k , the tree becomes a star, which is the base case of both the algorithms.
As mentioned above, D * C o = D C o 1 where D C o is the cost computed in D and D * C o is the cost computed in D * , for every odd iteration. Therefore after the ith iteration, the total improvement is ( i + 1 ) / 2 .
The upper bound value for all millipede trees with diameters up to 16 was computed for both D and D * . The results (refer Table 2) show that, δ * is smaller than δ . δ * and δ are deterministic for a millipede tree since the choice of vertices for deletion in each iteration does not alter the upper bound. δ δ * = ( d / 2 ) 1 establishes the fact that δ * is tighter on a millipede tree as the difference is directly proportional to the initial diameter d. In terms of the number of path graphs k in the tree M k , δ δ * can also be written as k / 2 .
Theorem 3.
δ δ * = Ω ( k ) for a millipede tree M k .

6. Scope for Future Research

An n-Broom (where n ≥ 3) is a transposition tree where the terminal node of the paths of n single brooms are connected to a common node. Figure 9 shows one of the possible 4-Brooms. Figure 10 and Figure 11 show two different possible swap sequences for a 3-Broom, where brooms B 1 , B 2 and B 3 are connected to the common node V 3 . Assume that all the star markers are homed, and only the path markers are left to be homed. The figures do not show the star markers, since these markers need not be swapped while homing the path markers. Figure 10 and Figure 11 n-Broom impacts the total swap count. Homing the path markers in B 3 before the path markers in B 1 (Figure 11) resulted in a non-optimal swap sequence which required more swaps than the swaps executed in Figure 10. Hence, A d b does not guarantee an optimal swap sequence for an n-broom. Thus, designing a polynomial time optimal algorithm for sorting permutations on n-brooms is open.

7. Conclusions

Sorting permutations using various operations has applications in computer interconnection networks and evolutionary biology. We designed a simpler O ( n 2 ) time algorithm for sorting permutations using the transposition tree single broom. We designed a novel O ( n 2 ) time algorithm for optimally sorting permutations with a double broom and proved its correctness.
We defined a new class of trees that we call millipede. Among the existing generic algorithms that sort with any given transposition tree, δ * and δ are the tightest and are comparable to one another. We showed that δ * yields a tighter upper bound than δ for a balanced millipede tree.
We also demonstrated how algorithm A d b does not yield an optimal swap sequence in the case of n-Broom, concluding that a polynomial-time algorithm for n-broom can be a subject of future research.

Author Contributions

Conceptualization, I.T.S. and B.C.; Writing—original draft, I.T.S.; Writing—review & editing, I.T.S. and B.C. All authors have read and agreed to the published version of the manuscript.

Funding

This research received no external funding.

Institutional Review Board Statement

Not applicable.

Informed Consent Statement

Not applicable.

Data Availability Statement

Not applicable.

Conflicts of Interest

The authors declare no conflict of interest.

References

  1. Akers, S.B.; Krishnamurthy, B. A group-theoretic model for symmetric interconnection networks. IEEE Trans. Comput. 1989, 38, 555–566. [Google Scholar] [CrossRef]
  2. Chitturi, B. On Transforming Sequences. University of Texas at Dallas. 2007. Available online: https://www.researchgate.net/profile/Bhadrachalam-Chitturi/publication/308524758_ON_TRANSFORMING_SEQUENCES/links/57e64be408aed7fe4667bb11/ON-TRANSFORMING-SEQUENCES.pdf (accessed on 1 June 2017).
  3. Heydemann, M.-C. Cayley graphs and interconnection networks. In Graph Symmetry; Springer: Dordrecht, The Netherlands, 1997; pp. 167–224. [Google Scholar]
  4. Lakshmivarahan, S.; Jwo, J.-S.; Dhall, S.K. Symmetry in interconnection networks based on Cayley graphs of permutation groups: A survey. Parallel Comput. 1993, 19, 361–407. [Google Scholar] [CrossRef]
  5. Jain, B.A.; Lubiw, K.; Masárová, A.; Miltzow, Z.; Mondal, T.; Naredl, D.; Murty, A.; Josef, T.; Alexi, T. Token Swapping on Trees. arXiv 2019, arXiv:1903.06981. [Google Scholar]
  6. Yamanaka, K.; Demaine, E.D.; Ito, T.; Kawahara, J.; Kiyomi, M.; Okamoto, Y.; Saitoh, T.; Suzuki, A.; Uchizawa, K.; Uno, T. Swapping labeled tokens on graphs. Theor. Comput. Sci. 2015, 586, 81–94. [Google Scholar] [CrossRef]
  7. Cooperman, G.; Finkelstein, L. New methods for using Cayley graphs in interconnection networks. Discret. Appl. Math. 1992, 37–38, 95–118. [Google Scholar] [CrossRef]
  8. Xu, J. Topological Structure and Analysis of Interconnection Networks; Springer Science & Business Media: Berlin/Heidelberg, Germany, 2013; Volume 7. [Google Scholar]
  9. Knuth, D.E. The Art of Computer Programming: Sorting and Searching, 2nd ed.; Pearson Education: London, UK, 1997; pp. 426–458. [Google Scholar]
  10. Vaughan, T.P. Factoring a permutation on a broom. J. Comb. Math. Comb. Comput. 1999, 30, 129–148. [Google Scholar]
  11. Kawahara, J.; Saitoh, T.; Yoshinaka, R. The Time Complexity of the Token Swapping Problem and Its Parallel Variants. Walcom Algorithms Comput. 2017, 448–459. [Google Scholar]
  12. Jerrum, M.R. The complexity of finding minimum-length generator sequences. Theor. Comput. Sci. 1985, 36, 265–289. [Google Scholar] [CrossRef][Green Version]
  13. Christie, D.A. Genome Rearrangement Problems; The University of Glasgow: Glasgow, UK, 1998. [Google Scholar]
  14. Chitturi, B.; Das, P. Sorting permutations with transpositions in O(n3) amortized time. Theor. Comput. Sci. 2019, 766, 30–37. [Google Scholar] [CrossRef]
  15. Chitturi, B. Computing cardinalities of subsets of Sn with k adjacencies. JCMCC 2020, 113, 183–195. [Google Scholar]
  16. Malavika, J.; Scaria, S.; Indulekha, T.S. On Token Swapping in Labeled Tree. In Proceedings of the 2021 Third International Conference on Inventive Research in Computing Applications (ICIRCA), Coimbatore, India, 2–4 September 2021; pp. 940–945. [Google Scholar]
  17. Bonnet, É.; Miltzow, T.; Rzazewski, P. Complexity of Token Swapping and Its Variants. Algorithmica 2017, 80, 2656–2682. [Google Scholar] [CrossRef][Green Version]
  18. Kawahara, J.; Saitoh, T.; Yoshinaka, R. The Time Complexity of Permutation Routing via Matching, Token Swapping and a Variant. JGAA 2019, 23, 29–70. [Google Scholar] [CrossRef]
  19. Miltzow, T.; Narins, L.; Okamoto, Y.; Rote, G.; Thomas, A.; Uno, T. Approximation and hardness of token swapping. In Proceedings of the 24th Annual European Symposium on Algorithms (ESA 2016), Aarhus, Denmark, 22–24 August 2016; Volume 57. [Google Scholar]
  20. Cayley, A. LXXVII. Note on the theory of permutations. Lond. Edinb. Dublin Philos. Mag. J. Sci. 1849, 34, 527–529. [Google Scholar] [CrossRef][Green Version]
  21. Pak, I. Reduced decompositions of permutations in terms of star transpositions, generalized catalan numbers and k-ARY trees. Discrete Math. 1999, 204, 329–335. [Google Scholar] [CrossRef][Green Version]
  22. Portier, F.J.; Vaughan, T.P. Whitney Numbers of the Second Kind for the Star Poset. Eur. J. Comb. 1990, 11, 277–288. [Google Scholar] [CrossRef][Green Version]
  23. Ganesan, A. An efficient algorithm for the diameter of cayley graphs generated by transposition trees. Aeng Int. J. Appl. Math. 2012, 42, 214–223. [Google Scholar]
  24. Chitturi, B. Upper Bounds For Sorting Permutations With A Transposition Tree. Discret. Math. Algorithm. Appl. 2013, 5, 1350003. [Google Scholar] [CrossRef]
  25. Kraft, B. Diameters of Cayley graphs generated by transposition trees. Discret. Appl. Math. 2015, 184, 178–188. [Google Scholar] [CrossRef]
  26. Uthan, S.; Chitturi, B. Bounding the diameter of Cayley graphs generated by specific transposition trees. In Proceedings of the International Conference on Advances in Computing, Communications and Informatics (ICACCI), Udupi, India, 13–16 September 2017; pp. 1242–1248. [Google Scholar]
  27. Balcza, L. On inversions and cycles in permutations. Period. Polytech. Civ. Eng. 1992, 36, 369–374. [Google Scholar]
  28. Edelman, P.H. On Inversions and Cycles in Permutations. Eur. J. Comb. 1987, 8, 269–279. [Google Scholar] [CrossRef][Green Version]
  29. Chitturi, B.; Indulekha, T.S. Sorting permutations with a transposition tree. In Proceedings of the 8th International Conference on Modeling Simulation and Applied Optimization (ICMSAO), Manama, Bahrain, 15–17 April 2019. [Google Scholar]
  30. Das, D.K.; Chitturi, B.; Kuppili, S.S. An Upper Bound For Sorting Permutations With A Transposition Tree. Procedia Comput. Sci. 2020, 171, 72–80. [Google Scholar] [CrossRef]
  31. Indulekha, T.S.; Chitturi, B. Analysis of Algorithm δ* on full binary trees. In Proceedings of the 2019 Second International Conference on Advanced Computational and Communication Paradigms (ICACCP), Gangtok, India, 25–28 February 2019; pp. 1–5. [Google Scholar]
Figure 1. A Transposition tree T and the corresponding Cayley graph Γ T .
Figure 1. A Transposition tree T and the corresponding Cayley graph Γ T .
Algorithms 15 00220 g001
Figure 2. Illustration for Algorithm A b . The star vertices are v 1 , v 2 , v 3 , v 4 , v 5 and the path vertices are v 6 , v 7 , v 8 . (a) (i) S m i n = 3, Swaps = 2; (ii) S m i n = 2, Swaps = 3. (b) P m a x = 8, Swaps = 1. (c) Unhomed Markers are 5 and 4, Swaps = 3.
Figure 2. Illustration for Algorithm A b . The star vertices are v 1 , v 2 , v 3 , v 4 , v 5 and the path vertices are v 6 , v 7 , v 8 . (a) (i) S m i n = 3, Swaps = 2; (ii) S m i n = 2, Swaps = 3. (b) P m a x = 8, Swaps = 1. (c) Unhomed Markers are 5 and 4, Swaps = 3.
Algorithms 15 00220 g002
Figure 3. Comparison of algorithm A b with Biniaz’s and Kawahara’s algorithms. (a) S m i n = 3, Swaps = 2; S m i n = 4, Swaps = 3. (b) Maximum valued path token ( P m a x ) = 9, Swaps = 3; P m a x = 8, Swaps = 3. (c) Maximum valued token ( T m a x ) = 9, Swaps = 3; T m a x = 8, Star tokens = {3}, Swaps = 4. (d) S m i n = 5, Swaps = 1; S m i n = 2, Swaps = 4. (e) P m a x = 7, centered star chain = {4,5,3,7}, Swaps = 4. (f) T m a x = 7, Star tokens = {4,5}, Swaps = 3. (g) S m i n = 1, Swaps = 1; P m a x = 8, Swaps = 1, Total Swaps = 12. (h) P m a x = 6, centered star chain = {2,1,6}, Swaps = 2, Total Swaps = 12. (i) T m a x = 6, Star tokens = {2,1}, Swaps = 2, Total Swaps = 12.
Figure 3. Comparison of algorithm A b with Biniaz’s and Kawahara’s algorithms. (a) S m i n = 3, Swaps = 2; S m i n = 4, Swaps = 3. (b) Maximum valued path token ( P m a x ) = 9, Swaps = 3; P m a x = 8, Swaps = 3. (c) Maximum valued token ( T m a x ) = 9, Swaps = 3; T m a x = 8, Star tokens = {3}, Swaps = 4. (d) S m i n = 5, Swaps = 1; S m i n = 2, Swaps = 4. (e) P m a x = 7, centered star chain = {4,5,3,7}, Swaps = 4. (f) T m a x = 7, Star tokens = {4,5}, Swaps = 3. (g) S m i n = 1, Swaps = 1; P m a x = 8, Swaps = 1, Total Swaps = 12. (h) P m a x = 6, centered star chain = {2,1,6}, Swaps = 2, Total Swaps = 12. (i) T m a x = 6, Star tokens = {2,1}, Swaps = 2, Total Swaps = 12.
Algorithms 15 00220 g003
Figure 4. (a) S = (1, 2), (2, 6), (2, 3), (1, 6), (1, 3), (1, 4). (b) Modified Swap Sequence = (1, 6), (1, 3), (2, 6), (2, 3).
Figure 4. (a) S = (1, 2), (2, 6), (2, 3), (1, 6), (1, 3), (1, 4). (b) Modified Swap Sequence = (1, 6), (1, 3), (2, 6), (2, 3).
Algorithms 15 00220 g004
Figure 5. Illustration for Algorithm A d b . (a) S m i n R = 7, Swaps = 1. (b) S m i n R = 8, Swaps = 4. (c) S m i n R = 9, Swaps = 1. (d) S m i n R = 1, Swaps = 2. (e) S m i n R = 3, Swaps = 1, S m i n R = 2, Swaps = 1. (f) All markers are homed. Total Swaps = 10.
Figure 5. Illustration for Algorithm A d b . (a) S m i n R = 7, Swaps = 1. (b) S m i n R = 8, Swaps = 4. (c) S m i n R = 9, Swaps = 1. (d) S m i n R = 1, Swaps = 2. (e) S m i n R = 3, Swaps = 1, S m i n R = 2, Swaps = 1. (f) All markers are homed. Total Swaps = 10.
Algorithms 15 00220 g005
Figure 6. Millipede tree, M 5 .
Figure 6. Millipede tree, M 5 .
Algorithms 15 00220 g006
Figure 7. Clusters in M 3 .
Figure 7. Clusters in M 3 .
Algorithms 15 00220 g007
Figure 8. (a) When C 1 is chosen as C * . (b) When C 2 is chosen as C * .
Figure 8. (a) When C 1 is chosen as C * . (b) When C 2 is chosen as C * .
Algorithms 15 00220 g008
Figure 9. n-Broom with n = 4 and v 22 as the connecting node.
Figure 9. n-Broom with n = 4 and v 22 as the connecting node.
Algorithms 15 00220 g009
Figure 10. One possible swap sequence of path markers on a 3-Broom shown in (a). (a) Homing 1, Swaps = 2. (b) Homing 5, Swaps = 2. (c) Homing 4, Swaps = 2. (d) Homing 7, Swaps = 2. (e) Homing 6, Swaps = 1. (f) All markers are homed. Total Swaps = 9.
Figure 10. One possible swap sequence of path markers on a 3-Broom shown in (a). (a) Homing 1, Swaps = 2. (b) Homing 5, Swaps = 2. (c) Homing 4, Swaps = 2. (d) Homing 7, Swaps = 2. (e) Homing 6, Swaps = 1. (f) All markers are homed. Total Swaps = 9.
Algorithms 15 00220 g010
Figure 11. Another possible swap sequence of path markers on the 3-Broom shown in Figure 10a. (a) Homing 7, Swaps = 4. (b) Homing 6, Swaps = 3. (c) Homing 5, Swaps = 3. (d) Homing 4, Swaps = 1. (e) Homing 1, Swaps = 2. (f) All markers are homed. Total Swaps = 13.
Figure 11. Another possible swap sequence of path markers on the 3-Broom shown in Figure 10a. (a) Homing 7, Swaps = 4. (b) Homing 6, Swaps = 3. (c) Homing 5, Swaps = 3. (d) Homing 4, Swaps = 1. (e) Homing 1, Swaps = 2. (f) All markers are homed. Total Swaps = 13.
Algorithms 15 00220 g011
Table 1. Cost of removing nodes in D and D * on millipede tree.
Table 1. Cost of removing nodes in D and D * on millipede tree.
Iteration C * S C * D C ( C * ) D C ( S C * ) D * C ( C * ) D * C ( S C * ) *
1(k − 1)2ddd(d − 1/2)
2k1(d − 1)(d − 1)(d − 1)-
3(k − 2)2(d − 2)(d − 2)(d − 2)(d − 2 − 1/2)
4(k − 2)0(d − 3)-(d − 3)-
5(k − 4)2(d − 4)(d − 4)(d − 4)(d − 4 − 1/2)
6(k − 4)0(d − 5)-(d − 5)-
7(k − 6)2(d − 6)(d − 6)(d − 6)(d − 6 − 1/2)
8(k − 6)0(d − 7)-(d − 7)-
(k − 1)303-3-
Table 2. Comparison of δ and δ * on millipede trees with various diameters.
Table 2. Comparison of δ and δ * on millipede trees with various diameters.
TreeDiameterNo:of Nodes δ v 1 δ v 2 δ * δ δ *
M 3 4112828271
M 5 6239292902
M 7 8392092092063
M 9 10593963963924
M 11 12836696696645
M 13 141111044104410386
M 15 161431537153715307
Publisher’s Note: MDPI stays neutral with regard to jurisdictional claims in published maps and institutional affiliations.

Share and Cite

MDPI and ACS Style

Sadanandan, I.T.; Chitturi, B. Optimal Algorithms for Sorting Permutations with Brooms. Algorithms 2022, 15, 220. https://doi.org/10.3390/a15070220

AMA Style

Sadanandan IT, Chitturi B. Optimal Algorithms for Sorting Permutations with Brooms. Algorithms. 2022; 15(7):220. https://doi.org/10.3390/a15070220

Chicago/Turabian Style

Sadanandan, Indulekha Thekkethuruthel, and Bhadrachalam Chitturi. 2022. "Optimal Algorithms for Sorting Permutations with Brooms" Algorithms 15, no. 7: 220. https://doi.org/10.3390/a15070220

Note that from the first issue of 2016, MDPI journals use article numbers instead of page numbers. See further details here.

Article Metrics

Back to TopTop