Lower bounding edit distances between permutations∗ 2 1 0 2 Anthony Labarre n a J January 4, 2012 1 ] M D Abstract . s A number of fields, including the study of genome rearrangements c [ and the design of interconnection networks, deal with the connected problems of sorting permutations in “as few moves as possible”, using 1 v a given set of allowed operations, or computing the number of moves 5 the sorting process requires, often referred to as the distance of the 6 permutation. These operations often act on just one or two segments 3 0 of the permutation, e.g. by reversing one segment or exchanging two 1. segments. Thecycle graph ofthepermutationtosortisafundamental 0 tool in the theory of genome rearrangements, and has proved useful 2 in settling the complexity of many variants of the above problems. 1 : In this paper, we present an algebraic reinterpretation of the cycle v graph of a permutation π as an even permutation π, and show how to i X reformulate our sorting problems in terms of particular factorisations r a of the latter permutation. Using our framework, we recover known results in a simple and unified way, and obtain a new lower bound on theprefix transposition distance (whereaprefix transposition displaces the initial segment of a permutation), which is shown to outperform previous results. Moreover, we use our approach to improve the best known lower bound on the prefix transposition diameter from 2n/3 to ⌊3n/4⌋, and investigate a few relations between some statistics on π and π. ∗ A significant portion of this work previously appeared in the Proceedings of the Six- teenth Annual European Symposium on Algorithms (ESA) [22]. 1 1 Introduction GivenasetS ofallowedoperationsandtwopermutationsπ andσof{1,2,...,n}, we study the related problems of computing, on the one hand, a sequence of elements of S of minimum length that transforms π into σ, and on the other hand, computing the length of such a sequence, referred to as the distance between π and σ. The operations in S usually yield an edit distance d (·,·) S with the property that d (π,σ) = d (σ−1 ◦ π,ι) for any two permutations S S π and σ of the same set, where ι is the identity permutation h1 2 ··· ni. This property allows us to restrict our attention to sorting permutations us- ing a minimum number of operations from S, or to computing the distance of a given permutation to the identity permutation rather than to another arbitrary permutation. Two areas in which these questions have applications are the fields of genome rearrangements and interconnection network design, which we briefly review below. In genome rearrangements (see Fertin et al. [12] for a survey), the per- mutation to sort represents an ordering of genes in a given genome, and the allowed operations model mutations that are known to actually occur in evolution. Rearrangements studied in that context include reversals [19], which reverse a segment of the permutation, block-interchanges [8], which ex- changetwonotnecessarily contiguoussegments, andtranspositions [3], which displace a block of contiguous elements. Those seemingly easy problems turn out to be more challenging than they might appear at first: although a polynomial-time algorithm is known for sorting by block-interchanges or computing the associated distance [8], the same problems were shown to be NP-hard for reversals [6], and more recently for transpositions [4]. In interconnection network design (see Lakshmivarahan et al. [23] for a thorough survey), permutations stand e.g. for processors, or other devices to be connected, and form the vertex set of a graph whose edges corre- spond to physical connections between two devices. One wants to build a graph with small degree and small diameter, among other desirable proper- ties. Akers and Krishnamurthy’s landmark paper [1] proposed the idea of choosing a set S that generates all permutations of {1,2,...,n}, and to use the corresponding Cayley graph, whose vertex set is the set of all permuta- tions and whose edges connect any two permutations that can be obtained fromone another by applying a transformation from S, as an interconnection network. In that setting, sorting algorithms for permutations correspond to routing algorithms for the corresponding networks, since a sequence of ele- 2 ments of S transforming π into σ corresponds to a path of the same length in the network. Two kinds of operations that received a lot of attention in that context are prefix reversals [15], which reverse the initial segment of the permutation, and prefix exchanges [2], which swap the first element of the permutation with another element. Those operations gave birth to the pan- cake network and star graph topologies, respectively, which are extensively studied models in that field. We also mention prefix transpositions, which displace the initial segment of the permutation, and were introduced by Dias and Meidanis [9] in the context of genome rearrangements in the hope that their study would shed light and give insight on the challenging problem of sorting by transpositions. Those more restricted versions of operations stud- ied in the context of genome rearrangements do not lead to problems simpler than their unrestricted counterparts: the sorting and distance computation problems related to prefix exchanges can be solved in polynomial time [2], but the complexity of those problems in the case of prefix transpositions is open, and the problem of sorting by prefix reversals has only recently been showed to be NP-hard [5], more than thirty years after the first works on the subject [15, 16]. The cycle graph of a permutation is a ubiquitous structure in the field of genome rearrangements, and has proved useful in resolving many questions related to the problems discussed in the above paragraphs. In this paper, we present a new way of encoding the cycle graph of a permutation π as an even permutation π, inspired by a previous work of ours [10], and show how to reformulate any sorting problem of the form described above in terms of par- ticular factorisations of the latter permutation. We first illustrate the power ofour framework by recovering known lower boundsontheblock-interchange and transposition distances in a simple and unified way, and then use it to prove a new lower bound on the prefix transposition distance. We prove that our lower bound always outperforms that obtained by Dias and Meidanis [9], and show experimentally that it is a significant improvement over both that result and the only other known lower bound proved by Chitturi and Sudbor- ough [7]. We then use this new result to improve the previously best known lower bound on the maximal value of the prefix transposition distance from 2n/3 to ⌊3n/4⌋. Finally, we examine some further properties of the model, and establish connections between statistics on π and π. 3 2 Notation and definitions 2.1 Permutations and conjugacy classes Let us start with a quick reminder of basic notions on permutations (for details, see e.g. Wielandt [25]). Definition 2.1. A permutation of a set Ω is a bijective application of Ω onto itself. It is convenient to set Ω = {1,2,...,n}, and we will follow this conven- tion here, although we will also sometimes use the set {0,1,2,...,n}. The symmetric group S is the set of all permutations of a set of n elements, n together with the usual function composition ◦, applied from right to left. Permutations are denoted by lower case Greek letters, and we will follow the convention of shortening the traditional two-row notation 1 2 ··· n π = π π ··· π 1 2 n (cid:28) (cid:29) by keeping only the second row, i.e. π = hπ π ··· π i, where π = π(i). 1 2 n i Definition 2.2. The graph Γ(π) of the permutation π in S is the directed n graph with ordered vertex set (π ,π ,...,π ) and arc set {(i,j) | π = j,1 ≤ 1 2 n i i ≤ n}. Definition 2.1 implies that Γ(π) decomposes in a single way into disjoint cycles(uptotheorderingofcycles andofelements withineachcycle), leading to another notation for π based on its disjoint cycle decomposition. For instance, when π = h4 1 6 2 5 7 3i, the disjoint cycle notation is π = (1,4,2)(3,6,7)(5) (notice the parentheses and the commas). Definition 2.3. The length of a cycle in a graph is the number of vertices it contains, and a k-cycle is a cycle of length k. The number of cycles in a graph G will be denoted by c(G), and the numberofcyclesoflengthk willbedenotedbyc (G). Wewillalsodistinguish k between cycles of odd(resp. even) length, denoting the number of such cycles in G using c (G) (resp. c (G)). It is common practice to omit 1-cycles odd even in the cycle decomposition of (the graph of) a permutation, and to call that permutation a k-cycle if the resulting decomposition consists of a single cycle of length k > 1. Cycles of length 1 in the disjoint cycle decomposition of a permutation are referred to as fixed points. 4 Definition 2.4. A permutation π is even if the number of even cycles in Γ(π) is even or, equivalently, if it can be expressed as a product of an even number of 2-cycles. The alternating group A is the subgroup of S formed by the set of all n n even permutations, together with ◦. The following notion will be central to this work. Definition 2.5. The conjugate of a permutation π by a permutation σ, both in S , is the permutation πσ = σ ◦ π ◦ σ−1, and can be obtained by n replacing every element i in the disjoint cycle decomposition of π with σ . i All permutations in S that have the same disjoint cycle decomposition form n a conjugacy class (of S ). n 2.2 Generating sets and edit distances We are interested in distances between permutations based on operations that can themselves be modelled as permutations. More formally, given a subset S of S and two permutations π and σ in S , we have two goals: n n 1. to find a sequence of elements s ,s ,...,s from S whose cardinality 1 2 t is minimum and whose product transforms π into σ (or conversely, σ into π): π ◦s ◦s ◦···◦s = σ. 1 2 t 2. to find the length of such a sequence, called the S distance between π and σ. Distances whose definition is based on a set of allowed opera- tions as described above are often referred to as edit distances. Note that S must be symmetric, i.e. s ∈ S if and only if s−1 ∈ S, for the corresponding distance to satisfy the symmetry axiom. An immediate corollary of this property is that for any π in S , we have d(π,ι) = d(π−1,ι). n For any two permutations of the same set to be a finite distance apart, S must also satisfy the following property. Definition 2.6. A set S ⊂ S is said to generate S , or to be a generating n n set of S , if every element of S can be expressed as the product of a finite n n number of elements of S. We call the elements of S generators of S . n Moreover, all generating sets we will consider in this paper yield distances that satisfy the following property. 5 Definition 2.7. A distance d on S is left-invariant if for all π, σ, τ in S , n n we have: d(π,σ) = d(τ ◦π,τ ◦σ). Intuitively, left-invariance models the fact that, given any two permuta- tionsπ andσ tobetransformedintooneanother, wecanrenametheelements of either permutation as we wish without changing the value of the distance between bothpermutations, aslongaswe renumber theelements oftheother permutation accordingly. Since we will most of the time be considering the distance between a permutation π and the identity permutation ι, we will often abbreviate d(π,ι) to d(π). It can be easily seen that both problems mentioned at the beginning of this section can be reformulated in terms of finding a minimum-length factorisation of π that consists only of elements of S, since π ◦s ◦s ◦···◦s = ι ⇔ π = s−1 ◦s−1 ◦···◦s−1 1 2 t t t−1 1 and S is symmetric. Finally, another parameter of interest in the study of those distances is the largest value they can reach. Definition2.8. Thediameter ofasetU underadistancedismax d(s,t). s,t∈U 2.3 Genome rearrangements and the cycle graph We recall here a few operations that are commonly used in the fields of genome rearrangements and interconnection network design to build gener- ating sets of S . n Definition 2.9. [8] The block-interchange β(i,j,k,l) with 1 ≤ i < j ≤ k < l ≤ n+1 is the permutation that exchanges the closed intervals determined respectively by i and j −1 and by k and l−1: 1 ··· i−1 i ··· j −1 j j +1 ··· k −1 k ··· l−1 l l+1 ··· n . * 1 ··· i−1 k ··· l −1 j j +1 ··· k −1 i ··· j −1 l l+1 ··· n + Two particular cases of block-interchanges are of interest: 1. when j = k, the resulting operation exchanges two adjacent intervals, and is called a transposition [3], denoted by τ(i,j,l); 6 2. when j = i+ 1 and l = k + 1, the resulting operation swaps two not necessarily adjacent elements in respective positions i and k, and is called an exchange, denoted by ε(i,k). We use the notation bid(π), td(π) and exc(π) for the block-interchange distance, the transposition distance, and the exchange distance of π, respec- tively. The operationswe described abovecanbefurtherrestricted by setting i = 1 in their definition, thereby transforming them into so-called “prefix rearrangements”. The corresponding “prefix distances” are defined in an analogous manner, with the additional restriction that all operations must act on the initial segment of the permutation. We denote ptd(π) and pexc(π) the prefix transposition distance and prefix exchange distance of π, respec- tively. While sorting by transpositions is NP-hard [4] and the computational complexity of sorting by prefix transpositions is unknown, polynomial-time algorithms exist for sorting by block-interchanges [8], exchanges [18] or prefix exchanges [2], as well as formulas for computing the associated distances. We will have more to say about sorting by transpositions and sorting by block-interchanges in Section 4, where we will give simple proofs of lower bounds on the two corresponding distances, as well as about sorting by prefix transpositions in Section 5, where we will prove new and improved lower bounds on the associated distance and diameter. Meanwhile, we con- clude this section with the following traditional tool introduced by Bafna and Pevzner [3], which has proved most useful in the study of genome rearrange- ments. Definition 2.10. The cycle graph of a permutation π in S is the bicoloured n directed graph G(π), whose vertex set (π = 0,π ,...,π ) is ordered by 0 1 n positions, and whose arc set consists of: • black arcs {(π ,π ) | 1 ≤ i ≤ n}∪{(π ,π )}; i i−1 0 n • grey arcs {(π ,π +1) | 0 ≤ i ≤ n}∪{(n,0)}. i i The arc set of G(π) decomposes in a single way into arc-disjoint alter- nating cycles, i.e. cycles that alternate black and grey arcs. The length of an alternating cycle in G(π) is the number of black arcs it contains, and a k-cycle in G(π) is an alternating cycle of length k (note that this differs from Definition 2.3). Figure 1 shows an example of a cycle graph, together with its decomposition into a 5-cycle and a 3-cycle. 7 0 0 0 3 4 3 4 3 4 7 1 7 1 7 1 5 6 5 6 5 6 2 2 2 (a) (b) (c) Figure 1: (a) The cycle graph of h4 1 6 2 5 7 3i; (b),(c) its decomposition into two alternating cycles. 3 A general lower bounding technique We now present a framework for obtaining lower bounds on edit distances between permutations in a simple and unified way. To that end, we adapt a bijection previously introduced by Doignon and Labarre [10]: f : S → A : π 7→ π = (0,1,2,...,n)◦(0,π ,π ,...,π ), (1) n n+1 n n−1 1 which in particular maps ι onto ι = h0 1 2 ··· ni. That mapping allows us to encode the structure of a cycle graph G(π) using an even permutation π in an intuitive way, which corresponds to decomposing the cycle graph into the product of two “monochromatic cycles”, namely, the cycle made of all black arcs (i.e. (0,π ,π ,...,π )) and the cycle made of all grey arcs n n−1 1 (i.e. (0,1,2,...,n)). The construction is perhaps best understood using an example: let π = h4 1 6 2 5 7 3i, whose cycle graphis depicted in Figure 1(a). Then π = (0,1,2,3,4,5,6,7)◦(0,3,7,5,2,6,1,4)= (0,4,1,5,3)(2,7,6), and the two disjoint cycles of π correspond to the two alternating cycles of G(π), whose elements they list in the order they are encountered (up to rotation); indeed: 1. the first cycle of G(π) (Figure 1(b)) starts with 0, then visits 4 after following a black-grey path (i.e. a black arc followed by a grey arc), 8 then visits 1 after following a black-grey path, and in the same way visits 5 and 3 before coming back to 0, which corresponds to the first cycle of π; 2. the second cycle of G(π) (Figure 1(c)) starts with 2, then visits 7 after following a black-grey path, and in the same way visits 6 before coming back to 2, which corresponds to the second cycle of π. Note that the order in which we decide to follow arcs (first a black arc and then a grey arc) is given by the order in which the two cycles are multiplied. An alternative definition1 of π could therefore have been (0,π ,π ,...,π ) ◦ (0,1,2,...,n), which can be seen to be equivalent to n n−1 1 ourdefinitionwhen conjugatedby (0,n,n−1,...,1), andwhosecycles arein- terpreted exactly as above, with the modification that grey arcs are followed first. Consequently, speaking about cycles of π, of Γ(π) or of G(π) is equiva- lent. We will now demonstrate how f(·) can be used to obtain results on the sorting and distance computation problems we discussed in Section 2.2. The following lemma expresses how the action of any rearrangement operation σ on π is translated on π. We will find it convenient to identify permu- tations in S with their extended versions in S (i.e. we identify π with n n+1 h0 π π ··· π i). This allows us to express any permutation π in S as 1 2 n n follows: π = (0,π ,π ,...,π )◦π ◦(0,1,2,...,n). (2) n n−1 1 Lemma 3.1. For all π, σ in S , we have π ◦σ = π ◦σπ. n Proof. By definition, we have: π ◦σ = (0,1,2,...,n)◦(0,(π ◦σ) ,(π ◦σ) ,...,(π ◦σ) ) n n−1 1 = (0,1,2,...,n)◦π ◦(0,σ ,σ ,...,σ )◦π−1 n n−1 1 = (0,1,2,...,n)◦(0,π ,π ,...,π )◦π ◦(0,1,2,...,n) n n−1 1 ◦(0,σ ,σ ,...,σ )◦π−1 (using Equation 2) n n−1 1 = π ◦σπ. We are now ready to prove our main result. 1 This is actually the definition we used in the conference version of this paper [22]. 9 Theorem 3.1. Let S be a subset of S whose elements are mapped by f(·) n onto S′ ⊆ A . Moreover, let C be the union of the conjugacy classes (of n+1 S ) that intersect with S′; then for any π in S , any factorisation of π into n+1 n t elements of S yields a factorisation of π into t elements of C. Proof. Induction on t. The base case is π ∈ S, and clearly π ∈ S′ ⊆ C. For the induction, let π = g ◦g ◦···◦g , where g ∈ S for 1 ≤ i ≤ t, and let t t−1 1 i σ = g ◦···◦g ◦g ; by Lemma 3.1, we have: t−1 2 1 π = g ◦g ◦···◦g ◦g = g ◦σ = g ◦σgt. t t−1 2 1 t t By induction, σ = g′ ◦ g′ ◦ ··· ◦ g′ , where g′ ∈ C for 1 ≤ i ≤ t − 1; t−1 t−2 1 i therefore: g ◦σ ◦g−1 = g ◦g′ ◦g′ ◦···◦g′ ◦g−1 t t t t−1 t−2 1 t = g ◦g′ ◦g−1◦g ◦g′ ◦g−1◦g ◦···◦g−1◦g ◦g′ ◦g−1 , t t−1 t t t−2 t t t t 1 t ht−1 ht−2 h1 and h ,h ,...,h | ∈ C{,zwhic}h c|omple{tzes the}proof. | {z } 1 2 t−1 We will use Theorem 3.1 in the next two sections to prove lower bounds on several edit distances between permutations. 4 Recovering previous results Weillustrate howto use Theorem 3.1to recover two previously known results onbid andtd. Thegeneral idea is asfollows: aswe explained inSection 2.2, if S is symmetric, then any sorting sequence of length t for π made of elements of S yields a factorisation of π into the product of t elements of S, which can in turn be converted, as in the proof of Theorem 3.1, into a factorisation of π into the product of t elements of S′ ⊆ C. Therefore, the length of a shortest factorisation of π into the product of elements of C is a lower bound on the length of a factorisation of π into the product of elements of S, and we can obtain a lower bound on the distance of interest by: 1. characterising the set of images of the elements in S by f(·), and 2. computing the distance of π with respect to C. 10