Sorting signed permutations by short operations

Background During evolution, global mutations may alter the order and the orientation of the genes in a genome. Such mutations are referred to as rearrangement events, or simply operations. In unichromosomal genomes, the most common operations are reversals, which are responsible for reversing the order and orientation of a sequence of genes, and transpositions, which are responsible for switching the location of two contiguous portions of a genome. The problem of computing the minimum sequence of operations that transforms one genome into another – which is equivalent to the problem of sorting a permutation into the identity permutation – is a well-studied problem that finds application in comparative genomics. There are a number of works concerning this problem in the literature, but they generally do not take into account the length of the operations (i.e. the number of genes affected by the operations). Since it has been observed that short operations are prevalent in the evolution of some species, algorithms that efficiently solve this problem in the special case of short operations are of interest. Results In this paper, we investigate the problem of sorting a signed permutation by short operations. More precisely, we study four flavors of this problem: (i) the problem of sorting a signed permutation by reversals of length at most 2; (ii) the problem of sorting a signed permutation by reversals of length at most 3; (iii) the problem of sorting a signed permutation by reversals and transpositions of length at most 2; and (iv) the problem of sorting a signed permutation by reversals and transpositions of length at most 3. We present polynomial-time solutions for problems (i) and (iii), a 5-approximation for problem (ii), and a 3-approximation for problem (iv). Moreover, we show that the expected approximation ratio of the 5-approximation algorithm is not greater than 3 for random signed permutations with more than 12 elements. Finally, we present experimental results that show that the approximation ratios of the approximation algorithms cannot be smaller than 3. In particular, this means that the approximation ratio of the 3-approximation algorithm is tight.


Background
One of the challenges of modern science is to understand how species evolve. As evolution can be viewed as a branching process, whereby new species arise from changes occurring in living organisms, the study of the evolutionary history of a group of species is commonly made by analyzing trees whose nodes represent species and edges represent evolutionary relationships. Since these relationships are referred to as phylogeny, such trees are called phylogenetic trees. a specific algorithm, such as Neighbor-Joining [2]. Therefore, a key point of distance-based methods is how to estimate the evolutionary distance between two species.
A well-accepted approach for estimating the evolutionary distance is the genome rearrangement approach [3]. It proposes to estimate the evolutionary distance between two species using the rearrangement distance between their genomes, which is the length of the shortest sequence of genome-wide mutations, called rearrangement events, that transforms one genome into the other. Assuming genomes consist of a single linear chromosome, share the same set of genes, and contain no duplicated genes, we can represent them as permutations of integers where each integer corresponds to a gene. Besides, each integer may have a sign, + or −, indicating the gene orientation. Permutations whose elements have signs are called signed permutations and permutations whose elements do not have signs are called unsigned permutations.
By representing genomes as permutations, the problem of finding the shortest sequence of rearrangement events that transforms one genome into another can be reduced to the combinatorial problem of calculating the minimum number of operations necessary to transform one permutation into another. By algebraic properties of permutations, this problem can be equivalently stated as the problem of calculating the minimum number of operations necessary to transform one permutation into the identity permutation (+1 + 2 . . . + n). This problem is commonly referred to as the permutation sorting problem.
Depending on the operations allowed to sort a permutation, we have a different variant of the permutation sorting problem. Reversals and transpositions are the most often considered operations for phylogenetic reconstruction. A reversal is responsible for reversing the order and flipping the signs of a sequence of elements within a permutation, while a transposition is responsible for switching the location of two contiguous portions of a permutation. The problem of sorting an unsigned permutation by reversals is an NP-hard problem [4]. It was introduced by Watterson et al. [5] and the best known result is due to Berman, Hannenhalli and Karpinski [6], who presented a 1.375-approximation algorithm. The problem of sorting a signed permutation by reversals was introduced by Bafna and Pevzner [7], who presented a 1.5-approximation algorithm. Hannenhalli and Pevzner [8] presented the first polynomial algorithm for this problem, which was further improved by Tannier, Bergeron and Sagot [9] to run in subquadratic time. Barder, Moret and Yan [10] showed how to determine the minimum number of reversals that sorts a signed permutation (without actually sorting) in linear time. The problem of sorting an unsigned permutation by transpositions is an NP-hard problem [11]. It was introduced by Bafna and Pevzner [12], who presented a 1.5-approximation algorithm. Later, Elias and Hartman [13] improved the approximation bound to 1.375. Variants of the permutation sorting problem which allow both reversals and transpositions are also regarded in the literature [14][15][16].
Simultaneously with the study of the aforementioned variants of the permutation sorting problem, some researchers have investigated variants in which bounds are imposed on the lengths of the operations. Jerrum [17] proved that the problem of sorting an unsigned permutation by reversals (or transpositions) of length 2 is solvable in polynomial time. Later, Heath and Vergara [18] considered the problem of sorting an unsigned permutation by reversals of length at most 3 and presented the best known result for it, a 2-approximation algorithm. Heath and Vergara [19,20] also considered the problem of sorting an unsigned permutation by transpositions of length at most 3 and presented a 4 3 -approximation algorithm. Jiang et al. [21] presented a (1+ )-approximation for unsigned permutations with many inversions and, more recently, Jiang et al. [22] also devised an 5 4 -approximation algorithm for sorting general unsigned permutations by transpositions of length at most 3. Finally, Vergara [23] showed that the 4 3 -approximation algorithm for the problem of sorting by transpositions of length at most 3 is a 2-approximation algorithm for the problem of sorting by reversals and transpositions of length at most 3.
The biological relevance of these bounded variants is grounded on the assumption that rearrangement events affecting large portions of a genome are less likely to occur. In the past, corroborating evidence has emerged, that is, separate sets of observations have shown the prevalence and significance of short reversals (i.e. reversals involving one or a few genes) in the evolution of bacterial genomes [24,25] and lower eukaryotes genomes [26,27]. This fact, together with the realization that signed permutations constitute a more biologically relevant model for genomes, motivated us to investigate the problem of sorting a signed permutation by short operations.
In preliminary work, Galvão and Dias [28] investigated the problem of sorting a signed permutation by reversals of length at most 3 and presented three approximation algorithms, the best one having an approximation factor of 9. In this paper, we not only present an approximation algorithm with a better approximation factor, but also consider other bounded variants. More precisely, we study four variants of the permutation sorting problem: (i) the problem of sorting a signed permutation by reversals of length at most 2, (ii) the problem of sorting a signed permutation by reversals of length at most 3, (iii) the problem of sorting a signed permutation by reversals and transpositions of length at most 2, and (iv) the problem of sorting a signed permutation by reversals and transpositions of length at most 3. We present polynomial-time solutions for problems (i) and (iii), a 5-approximation for problem (ii), and a 3-approximation for problem (iv). Moreover, we show that the expected approximation factor of the 5-approximation algorithm is not greater than 3 for random signed permutations with more than 12 elements. Finally, we present experimental results that show that the approximation factors of the approximation algorithms cannot be smaller than 3. In particular, this means that the approximation factor of the 3-approximation algorithm is tight.

Preliminaries
In this section, we present basic definitions that are used throughout this paper, generally following [28]. Let n be a positive integer.
A signed permutation π is a bijection of {−n, . . . , −2, −1, 1, 2, . . . , n} onto itself that satisfies π(−i) = −π(i) for all i ∈ {1, 2, . . . , n}. The two-row notation for a signed permutation is π i ∈ {1, 2, . . . , n} for 1 ≤ i ≤ n. The notation used in genome rearrangement literature, which is the one we will adopt, is the one-row notation π = (π 1 π 2 . . . π n ). Note that we drop the mapping of the negative elements since π(−i) = −π(i) for all i ∈ {1, 2, . . . , n}. By abuse of notation, we say that π has size n. The set of all signed permutations of size n is S ± n . A signed reversal ρ(i, j), 1 ≤ i ≤ j ≤ n, is an operation that transforms a signed permutation π = (π 1 π 2 . . . π i−1 π i π i+1 . . . π j−1 π j π j+1 . . . π n ) into the signed permutation π · ρ(i, j) = (π 1 π 2 . . . The problem of sorting by signed short reversals consists in finding the minimum number of signed short reversals that transform a permutation π ∈ S ± n into the identity permutation ι n = (+1 + 2 . . . + n). This number is referred to as the signed short reversal distance of permutation π and it is denoted by d ssr (π). Similarly, the problem of sorting by signed super short reversals consists in finding the minimum number of signed super short reversals that transform a permutation π ∈ S ± n into ι n . This number is referred to as the signed super short reversal distance of permutation π and it is denoted by d sssr (π).
A transposition ρ(i, j, k), 1 ≤ i < j < k ≤ n + 1, is an operation that transforms a signed permutation π = (π 1 . . . π i−1 π i . . . π j−1 π j . . . π k−1 π k . . . π n ) into the signed permutation π · ρ(i, j, k) = The problem of sorting by signed short operations consists in finding the minimum number of signed short reversals and short transpositions that transform a permutation π ∈ S ± n into ι n . This number is referred to as the signed short operation distance of permutation π and it is denoted by d sso (π). Similarly, the problem of sorting by signed super short operations consists in finding the minimum number of signed super short reversals and super short transpositions that transform a permutation π ∈ S ± n into ι n . This number is referred to as the signed super short operation distance of a permutation π and it is denoted by d ssso (π).
We say that a pair of elements (π i , π j ) of a signed permutation π is an inversion if i < j and |π i | > |π j |. The number of inversions in a signed permutation π is denoted by Inv(π). Lemma 1. Let π be a signed permutation. If Inv(π) > 0, then there exists an inversion (π i , π j ) such that j = i + 1.
Let Inv(π, ρ) denote the change in the number of inversions in a signed permutation π due to the application of an operation ρ, that is, Inv(π, ρ) = Inv(π) − Inv(π · ρ). The following lemma provides bounds on the value of Inv(π, ρ) considering that ρ is a short operation.

Sorting by bounded signed reversals
In this section, we present a polynomial-time solution for the problem of sorting by super short signed reversals and a 5-approximation algorithm for the problem of sorting by signed short reversals. Before we present the main results, we first introduce a useful tool for tackling these problems, the vector diagram. This tool was also used by Heath and Vergara [18,23] for the problem of sorting by (unsigned) short reversals.

The vector diagram
For each element π i of a signed permutation π, we define a vectorv(π i ) whose length is given by |v(π i )| = ||π i |−i|. If |v(π i )|> 0, the vector v(π i ) has a direction indicated by the sign of is said to be a positive zero vector if π i = i and a negative zero vector if π i = −i. A vector diagram V π of π is the set of vectors of the elements of π. The sum of the lengths of all the vectors in V π is denoted by Vec(π). See Figure 1 for an example.
Two elements π i and π j , i < j, of a signed permutation π are said to be vector-opposite if the vectors v(π i ) and v(π j ) differ in direction, |v(π i )| ≥ j − i, and |v(π j )| ≥ j − i. Besides, they are said to be m-vector-opposite if j − i = m. Note that m specifies the distance between vectoropposite elements. For instance, in Figure 1 the elements π 2 = −4 and π 4 = −1 are 2-vector-opposite elements. Lemma 3. Let π be a signed permutation. If Inv(π) > 0, then π contains at least a pair of vector-opposite elements.
Proof. We say that an element π e in π is out-of-place if |π e | = e. Note that there must exist out-of-place elements in π if Inv(π) > 0. Among all out-of-place elements in π, let π i be the one with the greatest absolute value. We first show by contradiction that v(π i ) is a right vector. Suppose v(π i ) is a left vector, that is, |π i | − i < 0. Then the element π k such that |π k | = i is an out-of-place element with absolute value greater than |π i |, a contradiction. Now since there is at least one right vector in V π , there exists a rightmost right vector in V π , that is, a right vector v(π i ) such that i is as large as possible. The element π k such that k = |π i | is out-of-place since |π k | = k. The vector v(π k ) is therefore a left vector as it occurs to the right of v(π i ), the rightmost right vector. Consider the elements π i+1 , π i+2 , . . . , π k . At least one of these elements corresponds to a left vector. Select the leftmost left vector from these elements, that is, select the vector v(π j ) such that i + 1 ≤ j ≤ k and j is as small as possible.
We claim that π i and π j are vector-opposite elements. Since |v(π i )| = k ≥ j, all that remains to be shown is that |v(π j )| ≤ i. In other words, we need to show that the correct position of element π j does not occur to the right of position i. For a contradiction, suppose this is the case. Then the element π t such that t = |π j | is out-ofplace and therefore v(π t ) is either a right or left vector. It is not a right vector since it occurs on the right of v(π i ), the rightmost right vector. It is not a left vector since it occurs on the left of v(π j ), the leftmost left vector from a set that includes v(π t ). Then we have a contradiction since we have found an out-of-place element that corresponds to a zero vector. The lemma follows.
Proof. We have that and therefore the lemma follows.
Let Vec(π, ρ) denote the change in the sum of the lengths of all the vectors in V π due to the application of a signed reversal ρ, that is, Vec(π, ρ) = Vec(π) − Vec(π · ρ). The following lemma provides bounds on the value of Vec(π, ρ) considering that ρ is a signed short reversal.
Proof. Suppose first that ρ is a signed 1-reversal ρ(i, i). In this case, ρ does not affect the length of the vector v(π i ), therefore Vec(π, ρ) = 0. Now, suppose that ρ is a signed 2-reversal ρ(i, i + 1). If the elements π i and π i+1 are 1-vector-opposite, then Vec(π, ρ) = 2. On the other hand, if v(π i ) is a zero or a left vector and v(π i+1 ) is a zero or a right vector, then Vec(π, ρ) = −2. Note that Vec(π, ρ) cannot be greater than 2 and cannot be less than -2 because ρ(i, i+1) can increase or decrease the length of v(π i ) and v(π i+1 ) by just one unit.
Finally, suppose that ρ is a signed 3-reversal ρ(i, i + 2). Note that ρ does not affect the length of the vector v(π i+1 ). Now, if the elements π i and π i+2 are 2-vectoropposite, then Vec(π, ρ) = 4. On the other hand, if v(π i ) is a zero or a left vector and v(π i+2 ) is a zero or a right vector, then Vec(π, ρ) = −4. Note that Vec(π, ρ) cannot be greater than 4 and cannot be less than −4 because ρ(i, i + 2) can increase or decrease the length of v(π i ) and v(π i+2 ) by just two units.

Sorting by signed super short reversals
From the proof of Lemma 2, we have that a signed 1reversal does not change the number of inversions in a signed permutation and a signed 2-reversal can eliminate at most one inversion. This means that, for sorting a signed permutation π, we have to apply Inv(π) signed 2-reversals plus a given number of signed 1-reversals in order to flip the signs of the remaining negative elements. The question is: how many signed 1-reversals do we have to apply?
Intuitively, if an element π i is in t distinct pairs of inversions in a signed permutation π, then its sign will be flipped t times, one time per signed 2-reversal applied. Therefore, if π i is negative and t is even, then π i will remain negative after we apply the t signed 2-reversals. The same is true when π i is positive and t is odd. We can make use of the vector diagram in order to capture this intuition formally. Let and |v(π i )| is odd}. The elements of a signed permutation π whose vectors belong to either V even − π or V odd + π are precisely the elements which will be negative after we apply the Inv(π) signed 2-reversals (Lemma 6). Using this fact, we can obtain an exact formula for the signed super short reversal distance of a signed permutation π (Theorem 1).
Proof. It suffices to prove that if we apply an arbitrary signed super short reversal on π, then the resulting permutation π satisfies Suppose first that we apply a signed 1-reversal ρ(i, i) on π and let π denote the resulting permutation. We have that Inv(π ) = Inv(π). Moreover, since the sign of π i is flipped without changing the parity of |v(π i )|, we have that Summing the previous equality with this inequality we obtain (2). Now, suppose that we apply a signed 2-reversal ρ(i, i+1) on π and let π denote the resulting permutation. We have that |V even − π |+|V odd + π |= |V even − π |+|V odd + π | (Lemma 6). Moreover, since a signed 2-reversal can remove at most one inversion, we have that Inv(π ) ≥ Inv(π) − 1. Summing the previous equality with this inequality we obtain (2). Therefore the lemma follows.

Theorem 1. Let π be a signed permutation. Then, we have that d sssr
Proof. Immediate from Lemmas 7 and 8.
From the proof of Lemma 7, we can derive the following optimal algorithm for sorting a signed permutation by signed super short reversals. First, perform signed 2-reversals on the inversions until the permutation has no inversions. Then, perform signed 1-reversals on the negative elements until the permutation has no negative elements. Since a signed permutation π ∈ S ± n can have at most n 2 inversions and at most n negative elements, we have that this algorithm runs in O(n 2 ) time. We remark that the value of d sssr (π) can be computed in O(n log n) time because computing |V even − π |+|V odd + π | takes O(n) time and computing Inv(π) takes O(n log n) time [29].

Sorting by signed short reversals
A trivial algorithm for the problem of sorting by signed short reversals is the optimal algorithm for the problem of sorting by signed super short reversals. From the lower bound of Lemma 9, it follows that this trivial algorithm is a 6-approximation algorithm. Moreover, we have that this approximation bound is tight. For instance, we need 6 signed super short reversals for sorting the signed permutation (−3 − 2 − 1), but one signed 3-reversal is sufficient for sorting it.

Lemma 9.
Let π be a signed permutation. Then, we have Proof. It suffices to prove that if we apply an arbitrary signed short reversal on π, then the resulting permutation π satisfies From the proof of Lemma 8, we have that (3) holds when we apply a signed super short reversal on π. So, suppose that we apply the signed 3-reversal ρ(i, i + 2) on π and let π denote the resulting permutation. We have that Inv(π ) ≥ Inv(π) − 3. Moreover, we have that Summing both inequalities we obtain (3), and the lemma follows.
is a negative zero vector}. By using these two subsets of V π , we can obtain better bounds on the signed short reversal distance of a signed permutation π (Lemmas 11 and 12). These bounds lead to a 5approximation for the problem of sorting by signed short reversals (Theorem 2). We note that the upper bound given in Lemma 11 relies on the fact that it is always possible to switch the positions of a pair of m-vector-opposite elements (without affecting the elements between them) applying m signed short reversals (Lemma 10).

Lemma 10.
Let π ∈ S ± n be a signed permutation such that Inv(π) > 0 and let π i and π j be m-vector-opposite elements. It is possible to transform π into π ∈ S ± n such that |π i | = |π j |, |π j | = |π i , and |π k | = |π k | for all k / ∈ {i, j} applying d signed short reversals, where Proof. We have two cases to consider: a) m is even. In this case, we can transform π into a signed permutation π ∈ S ± n such that . Therefore, to transform π into π , we can apply m-1 signed 3-reversals. b) m is odd. In this case, we can transform π into a signed permutation π ∈ S ± n such that |π i | = |π j |, |π j | = |π i |, and π k = π k for all k / ∈ {i, j} applying the sequence of signed short reversals ρ(i, i + 2), . Therefore, to transform π into π , we can apply m-1 signed 3-reversals and one signed 2-reversal, totalizing m signed short reversals.
Since in both cases we can transform π into π applying 2 m 2 − 1, the lemma follows.
Lemma 11. Let π be a signed permutation. Then, we Proof. It suffices to prove that it is always possible to apply a sequence of t > 0 signed short reversals on π = ι n in such a way that the resulting permutation π satisfies If Vec(π) = 0, then |v(π i )| = 0 for every π i in π. This means that |V odd π | = 0. Therefore we can sort π with |V 0 − π | signed 1-reversals and (4) holds.
If Vec(π) > 0, then π contains at least one pair of vector-opposite elements (Lemma 3). Let π i and π j , i < j, be m-vector-opposite elements. Now, suppose that we apply the d signed reversals described in Lemma 10 on π and let π denote the resulting permutation. We will show that the application of this sequence of signed short reversals results in an average decrease in of at least 1 unit per signed short reversal. In other words, we need to show that (π,π ) d ≥ 1. In order the evaluate the value of (π, π ), we divide our analysis in two cases: a) m is even. In this case, we have that the parities of the lengths of the vectors do not change, therefore |V odd π | − |V odd π | = 0. In order to evaluate the value of |V 0 − π | − |V 0 − π |, we further divide our analysis into three subcases: i) |v(π i )| and |v(π j )| are even. In this subcase, we have that the vectors v(π i ), v(π j−1 ), and v(π j ) may become negative zero vectors, ii) |v(π i )| and |v(π j )| have distinct parities. In this subcase, we have that the vector v(π j−1 ) and one of the vectors v(π i ) and v(π j ) (precisely the one whose length is even) may become negative zero vectors, therefore iii) |v(π i )| and |v(π j )| are odd. In this subcase, we have that none of the vectors v(π i ) and v(π j ) can become a negative zero vector, but the vector v(π j−1 ) can. Therefore b) m is odd. In this case, we further divide our analysis into three subcases: i) |v(π i )| and |v(π j )| are even. In this subcase, we have that none of the vectors v(π i ) and v(π j ) can become a negative zero vector, ii) |v(π i )| and |v(π j )| have distinct parities. In this subcase, we have that the parities of the lengths of the vectors v(π i ) and v(π j ) are switched, therefore |V odd π | − |V odd π | = 0. Moreover, one of the vectors v(π i ) and v(π j ) (precisely the one whose length is odd) may become a negative zero vector, therefore This means that (π, π ) ≥ 2m − 1. iii) |v(π i )| and |v(π j )| are odd. In this subcase, we have that |v(π i )| and |v(π j )| become even, therefore |V odd π | − |V odd π | = 2. On the other hand, we have that the vectors v(π i ) and v(π j ) may become negative zero vectors, therefore This means that (π, π ) ≥ 2m.
Note that the only subcase in which we have (π,π ) d < 1 is subcase (b.i), precisely when m = 1. So, assume that we have no choice other than selecting a pair of 1-vectoropposite elements π i and π j such that |v(π i )| and |v(π j )| are even. We will show that it is still possible to apply a sequence of signed short reversals on π in such a way that (4) holds.
Let v(π i ) be the rightmost right vector of π, that is, i is the largest integer for which v(π i ) is a right vector. As shown in the proof of Lemma 3, there exists an element π j , j > i, such that π i and π j form a pair of vector-opposite elements. Combining this fact with our initial assumption, we can conclude that j = i + 1.
Now, suppose that we apply the signed short reversal ρ(i, i + 1) on π and let π denote the resulting permutation. From our previous case-by-case analysis, we have that (π, π ) = 0. Moreover, we have that v(π i+1 ) is the rightmost right vector of π . Therefore, there exists an element π k , k > i + 1, such that π i+1 and π k form a pair of m-vector-opposite elements, as shown in the proof of Lemma 3. This means that we can apply the d short signed reversals described in Lemma 10 on π , obtaining permutation π . Given that |v(π i+1 )| is odd, we can conclude from our previous case-by-case analysis that (π , π ) ≥ 2m − 1 if m is odd and (π , π ) ≥ 2m − 2 if m is even. Hence, the average decrease in (π, π ) is of at least 2m−1 m+1 units per signed short reversal if m is odd and of at least 2m−2 m units per signed short reversal if m is even. Note that 2m−1 m+1 < 1 when m = 1, but in this case we show that the average decrease in (π, π ) is of at least 1 unit per signed short reversal. We have two cases to consider: 1) |v(π k )| is odd. In this case, we have that (π , π ) ≥ 2, therefore the average decrease in (π, π ) is of at least 1 unit per signed short reversal. 2) |v(π k )| is even. We show that this case cannot happen. For the sake of contradiction, assume that |v(π k )| is even. Then, we have that |v(π k )| ≥ 2.
Besides, since m = 1, we have that k = i + 2. These two facts imply that π i and π i+2 are 2-vector-opposite elements, but it contradicts our initial hypothesis that we had no choice other than selecting a pair of 1-vector-opposite elements.
Since it always possible to apply a sequence of t signed short reversals on π in such a way that the resulting permutation π satisfies (4), the lemma follows.

Lemma 12.
Let π be a signed permutation. Then, we Proof. It suffices to prove that if we apply an arbitrary signed short reversal on π, then the resulting permutation π satisfies Suppose first that we apply a signed 1-reversal ρ(i, i) on π and let π denote the resulting permutation. We have that Vec(π ) = Vec(π) and |V odd π | = |V odd π |. Moreover, since the sign of π i is flipped without changing the parity of |v(π i )|, we have that Summing the previous equalities with this inequality we obtain (5).
Suppose now that we apply a signed 2-reversal ρ(i, i + 1) on π and let π denote the resulting permutation. We have that Vec(π ) ≥ Vec(π) − 2. Moreover, we have that Summing the previous inequalities we obtain (5).

Theorem 2. The problem of sorting by short signed reversals is 5-approximable.
Proof. Immediate from Lemmas 11 and 12.
Heath and Vergara [18] have described an algorithm for finding vector-opposite elements which runs in linear time on n, the size of the input permutation. Basically, what their algorithm does is to find vector-opposite elements π i and π j such that v(π i ) is the rightmost right vector of π. Algorithm 1 is an adaptation of that algorithm. The difference between the two algorithms is that, given a signed permutation π = ι n , Algorithm 1 guarantees that, if it returns a pair (π i , π i+1 ), then π i and π i+2 are not 2vector-opposite. Note that Algorithm 1 also runs in linear time on n.

Algorithm 1: Returns a pair of vector-opposite elements
Data: A permutation π ∈ S ± n . Result: A pair of vector-opposite elements. Algorithm 2 sorts a signed permutation in two steps. While the signed permutation has vector-opposite elements, the algorithm finds a pair of them using Algorithm 1 and then switches their positions applying the signed short reversals described in Lemma 10. When the signed permutation has no vector-opposite elements, the algorithm applies signed 1-reversals until the signed permutation has no negative elements.

Algorithm 2: Algorithm for sorting by signed short reversals
Data: A permutation π ∈ S ± n . Result: Number of signed short reversals applied for sorting π.
1 d ← 0 2 while Vec(π) > 0 do 3 Let π i and π j be m-vector opposite elements returned by Algorithm 1 4 Apply signed short reversals on π such as described in Lemma 10 5 d ← d + 2 m 2 − 1 6 end while 7 Apply signed 1-reversals on π until it has no negative elements and update d accordingly 8 return d It follows from Theorem 2 that Algorithm 2 is a 5approximation algorithm for the problem of sorting by short signed reversals. Regarding its time complexity, it suffices to compute the total cost of calls to lines 3, 4, and 7. The total cost of calls in line 3 equals the total cost for all calls to Algorithm 1. Although it runs in O(n) time and there are O(n 2 ) vector-opposite elements in a signed permutation, we can provide the Algorithm 1 with enough information so that the costs of calls to this algorithm can be significantly reduced. Note that Algorithm 1 performs two scans in the signed permutation, one for each vector of the vector-opposite elements returned. By observing that a rightmost right vector remains a rightmost vector until it becomes a zero vector, it need not be searched again if the vector has not been zeroed. Thus, the scan for the rightmost vector needs to be performed only O(n) times. In addition, the total cost of scans for the left vector for the same right vector is bounded by the length of the right vector, also O(n). The total cost for all calls to Algorithm 1 with this refinement is thus O(n 2 ). Each call to line 4 takes O(m) time, where m = j − i, and causes a strict decrease in Vec(π) of 2m units. Thus, the cost in this case is bounded by Vec(π) rather than the number of iterations performed in the while loop. As each vector has length at most n, we have that Vec(π) ≤ n 2 , meaning a cost of O(n 2 ) time for the calls to line 4. Finally, we have that line 3 runs in O(n) time, therefore Algorithm 2 runs in O(n 2 ) time.
We finish by noting that there exists a large class of signed permutations for which the approximation ratio of Algorithm 2 is much lower than its worst-case approximation ratio (Lemma 13). Moreover, based on the fact that the expected value of Vec(π) of a random signed permutation π ∈ S ± n is n 2 −1 3 (Lemma 15), we can conclude that the expected approximation ratio of Algorithm 2 for sorting a random signed permutation is also lower than the worst-case approximation ratio (Theorem 3). Just to make things clear, we define a random signed permutation as a random ordering of the elements {1, 2, . . . , n}, with the added characteristic that the sign, + or −, of each element is also randomly chosen. Lemma 13. Let A 2 (π) be the number of signed short reversals applied by Algorithm 2 for sorting a signed permutation π ∈ S ± n . We have that A 2 (π) d ssr (π) ≤ 3 when Vec(π) = 0 or Vec(π) ≥ 4n.
Proof. We have two cases to consider: a) Vec(π) = 0. In this case, we have that Algorithm 2 sorts π with |V 0 − π | signed 1-reversals. On the other hand, we have that d ssr (π) ≥ |V 0 − π | 3 because a signed short reversal cannot affect more than 3 elements at once. Therefore A 2 (π) d ssr (π) ≤ 3.
b) Vec(π) ≥ 4n. In this case, we have seen that Algorithm 2 sorts π in two steps. First it applies signed 2-reversals and signed 3-reversals on π until Vec(π) = 0 and then it applies signed 1-reversals on π until V 0 − π = 0. Note that, in the first step, each signed short reversal applied by Algorithm 2 results in an average decrease in Vec(π) of at least 2 units. Hence Algorithm 2 applies at most Vec(π) 2 signed short reversals in the first step. Moreover, Algorithm 2 applies at most n signed 1-reversals in the second step because |V 0 − π | ≤ n. On the other hand, we have that d ssr (π) ≥ Vec(π) 4 (Lemma 5). This analysis lead us to conclude that A 2 (π) d ssr (π) ≤ 2 + 4n Vec(π) . Therefore A 2 (π) d ssr (π) ≤ 3.
In what follows, let Pr(|v(π i )| = j) denote the probability that |v(π i )| is equal to j and E(X) denote the expected value of a random variable X.

Lemma 14.
Let π ∈ S ± n be a random signed permutation.
Proof. We have that |S ± n | = n! 2 n and for each 1 ≤ k ≤ n, there are (n − 1)! 2 n signed permutations for which |π i | = k. Then otherwise, for 0 ≤ j ≤ n − 1. In order to evaluate n i=1 Pr(|v(π i )| = j) for a given j, we consider two cases: In this case, we have that In this case, we have that otherwise.

Theorem 3.
The expected approximation ratio of Algorithm 2 for sorting a random signed permutation π ∈ S ± n is no greater than 3 for n ≥ 13.
Proof. According to Lemma 13, we have that the approximation ratio of Algorithm 2 for sorting a given signed permutation σ ∈ S ± n is no greater than 3 when Vec(σ ) ≥ 4n. Since we know that the expected value of Vec(π) of a random signed permutation π ∈ S ± n is n 2 −1 3 (Lemma 15), we conclude that the expected approximation ratio of Algorithm 2 for sorting π is no greater than 3 if n 2 −1 3 ≥ 4n. This inequality holds when n ≥ 13, and the theorem follows.

Sorting by bounded operations
In this section, we present a polynomial-time solution for the problem of sorting by super short operations and a 3-approximation algorithm for the problem of sorting by short operations. Before we present the main results, we first introduce a useful tool for tackling these problems, the permutation graph. This tool was also used by Heath and Vergara [20] for dealing with the problem of sorting by short transpositions.
Given a signed permutation π, we denote the number of connected components (or simply components) of G π by c(π). Moreover, we say that a component of G π is odd if it contains an odd number of negative elements (vertices) and we say it is even otherwise. The number of odd components of G π is denoted by c odd (π). Lastly, we say that an edge of G π is a cut-edge if its deletion increases the number of components of G π .

Sorting by signed super short operations
From the proof of Lemma 2, we have that a super short operation can eliminate at most one inversion of a signed permutation. This means that, for sorting a signed permutation π, we have to apply Inv(π) super short operations (i.e. 2-reversals and (1, 1)-transpositions) plus a given number of signed 1-reversals in order to flip the signs of the remaining negative elements. As before, the question is: how many signed 1-reversals do we have to apply? As Lemmas 16 and 17 show, the answer is c odd (π). Lemma 16. Let π ∈ S ± n be a signed permutation. Then, we have that d ssso (π) ≤ Inv(π) + c odd (π).
Proof. It suffices to prove that it is always possible to apply a signed super short operation on π = ι n in such a way that the resulting permutation π satisfies Inv(π ) + c odd (π ) ≤ Inv(π) + c odd (π) − 1.
If Inv(π) = 0, then each component of G π is a single vertex. Therefore, we can sort π with c odd (π) signed 1reversals and (6) holds.
If Inv(π) > 0, then there exists an edge e = (π i , π i+1 ) in G π (Lemma 1). Suppose first that e is not a cut-edge and that we apply the (1, 1)-transposition ρ(i, i + 1, i + 2) on π, obtaining the permutation π . We have that Inv(π ) = Inv(π) − 1. Moreover, since e is not a cut-edge, we have that the vertex sets of the components of G π are the same as of the components of G π . This means that c odd (π ) = c odd (π). Summing both equalities we obtain (6). Now, suppose that e is a cut-edge and let C denote the component of G π which contains e. Moreover, let C 1 and C 2 denote the components of C − e and assume, without loss of generality, that π i ∈ C 1 . We have three cases to consider: a) C 1 and C 2 are both even. Note that C is even. Apply the (1, 1)-transposition ρ(i, i+1, i+2) on π and let π denote the resulting permutation. Then, we have that Inv(π ) = Inv(π) − 1 and that c odd (π ) = c odd (π). Summing both equalities we obtain (6). b) C 1 and C 2 have distinct parities. Note that C is odd.
Since it is always possible to apply a signed super short operation on π in such a way that the resulting permutation π satisfies (6), the lemma follows.
Suppose first that we apply a signed 1-reversal ρ(i, i) and let π denote the resulting permutation. Then, we have that Inv(π ) = Inv(π). Moreover, since the component containing π i may become even, we have that c odd (π ) ≥ c odd (π) − 1. Summing the previous equality with this inequality we obtain (7). Now, suppose that we apply the (1, 1)-transposition ρ(i, i + 1, i + 2) on π and let π denote the resulting permutation. We have two cases to consider: is not an inversion. In this case, we have that Inv(π ) = Inv(π) + 1. On the other hand, by adding a new edge, we may eliminate two odd components, therefore c odd (π ) ≥ c odd (π) − 2.
Summing the previous equality with this inequality we obtain (7). b) (π i , π i+1 ) is an inversion. In this case, we have that Inv(π ) = Inv(π) − 1. Moreover, let e = (π i , π i+1 ) be an edge of G π and let C be the component of G π containing e and. We further divide our analysis into two subcases: i) e is not a cut-edge. In this case, we have that c odd (π ) = c odd (π) because the parity of the component C − e is the same as of C, therefore (7) holds. ii) e is a cut-edge. In this case, let C 1 and C 2 denote the components of C − e. If C is odd, then either C 1 or C 2 is odd. If C is even, then either C 1 and C 2 are both odd or C 1 and C 2 are both even. In any case, we have that c odd (π ) ≥ c odd (π), therefore (7) holds.
Finally, suppose that we apply the signed 2-reversal ρ(i, i + 1) on π and let π denote the resulting permutation. By making use of an argument analogous to the one in the previous paragraph, we conclude that π satisfies (7) and the lemma follows.
Let π be a signed permutation. From the proof of Lemma 17, we can conclude that a super short operation cannot decrease the value of c odd (π) if it is applied on an inversion in π. Moreover, from the proof of Lemma 16, we can conclude that if a (1, 1)-transposition increases the value of c odd (π) when applied on an inversion in π, then it is possible to apply a signed 2-reversal on this inversion in such a way that c odd (π) remains unaltered. These observations lead us to the following optimal algorithm for sorting by signed super short operations (Algorithm 3).

Algorithm 3: Optimal algorithm for sorting by super short operations
Data: A permutation π ∈ S ± n . Result: Number of super short operations applied for sorting π.
if c odd (π) > c odd then 7 π ← π · ρ(i, i + 1, i + 2) undo the previous (1, 1)-transposition 8 π ← π · ρ(i, i + 1) 9 end if 10 d ← d + 1 11 end while 12 Apply signed 1-reversals on π until it has no negative elements and update d accordingly 13 return d The time complexity of Algorithm 3 depends on the time complexity of the algorithm used to compute the value of c odd (π). A straightforward algorithm is to traverse G π with a depth-first search and count the number of odd components. Such an algorithm runs in O(n 2 ) time. It is possible, however, to count the number of odd components in G π in O(n) time.
Koh and Ree [30] have studied the permutation graph of unsigned permutations and have demonstrated some useful properties about them. Since the permutation graph of the signed permutation π ∈ S ± n is isomorphic to the permutation graph of the unsigned permutation (|π 1 ||π 2 | . . . |π n |), we are able to translate those properties to the permutation graph of signed permutations. In particular, Lemma 18 represents the translation of one of those properties.

Lemma 18.
Let π ∈ S ± n be a signed permutation. The vertex sets of the components of G π are of the form We say that a contiguous sequence of elements π i π i+1 . . . π j , i ≤ j, of a signed permutation π is a complete substring if {|π i |, |π i+1 |, . . . , |π j |} = {i, i + 1, . . . , j}. From Lemma 18, we have that the vertex set of a component of G π forms a complete substring. Furthermore, assume that {π i , π i+1 , . . . , π j } is the vertex set of a component of G π . We claim that π i π i+1 . . . π j is the minimum complete substring that starts with π i . For the sake of contradiction, suppose that there exists a complete substring π i π i+1 . . . π k such that k < j. We have that π l > π m for every i ≤ l ≤ k and k + 1 ≤ m ≤ j. Therefore there does not exist any edge in G π connecting the elements in {π i , π i+1 , . . . , π k } with the elements in {π k+1 , π k+2 , . . . , π j }. But this contradicts our hypothesis that {π i , π i+1 , . . . , π j } is the vertex set of a component of G π .
From the discussion of the last paragraph, we can design the following algorithm for finding the vertex sets of the components of the permutation graph of a signed permutation π ∈ S ± n . Find the minimum complete substring π 1 π 2 . . . π k starting with π 1 and let C 1 = {π 1 , π 2 , . . . , π k } be a component of G π . If k < n, then find the minimum complete substring π k+1 π k+2 . . . π l starting with π k+1 and let C 2 = {π k+1 , π k+2 , . . . , π l } be another component of G π . Continue with this process until all elements have been assigned to a component. It remains to show how to find the minimum complete substring π i π i+1 . . . π j starting with π i . Note that i is the least element and j is the largest element of the set S = {|π i |, |π i+1 |, . . . , |π j |}. Since all integers in the interval [ i, j] are in S, we have that |S| = j − i + 1. This fact give us the necessary and sufficient condition for knowing when we have found the last element of the minimum complete substring starting with π i . The complete algorithm is detailed below (Algorithm 4).

Algorithm 4: Find the vertex sets of the components of a permutation graph
Data: A permutation π ∈ S ± n . Result: The vertex sets of the components of G π .

Sorting by signed short operations
A trivial algorithm for the problem of sorting by signed short operations is the optimal algorithm for the problem of sorting by signed super short operations. From the lower bound of Lemma 19, it follows that this algorithm is a 4-approximation algorithm. In addition, we have that this approximation bound is tight. For instance, we need 4 signed super short operations for sorting the signed permutation (−3 − 2 − 1), but one signed 3-reversal is sufficient for sorting it.
Since (8) holds in any case, the lemma follows.
Given a signed permutation π, let c t odd (π) be the number of odd components of G π which have exactly t vertices. By just considering the odd components having at most two vertices, we can obtain better bounds on the signed short operation distance of a signed permutation π (Lemmas 21 and 22). These bounds lead to a 3approximation for the problem of sorting by signed short reversals (Theorem 5). We note that the upper bound given in Lemma 21 relies on the fact that we can establish an isomorphism between a component with m vertices and the permutation graph of a signed permutation σ ∈ S ± m (Lemma 20).

Lemma 20.
Let π ∈ S ± n be a signed permutation and let C = (V C , E C ) be a component of G π with m vertices. Then, there exists a signed permutation σ ∈ S ± m such that G σ is isomorphic to C.
Since it is always possible to apply a sequence of signed short operations on π in such a way that the resulting permutation π satisfies (9), the lemma follows.
Since (10) holds in every case, the lemma follows. Let π be a signed permutation. From the proof of Lemma 21, we can conclude that as long as Inv(π) > 0, we can apply a sequence of short operations that eliminates inversions and keeps the value of c 2 odd (π) + c 1 odd (π) unchanged. When Inv(π) = 0, we can sort π applying c 1 odd (π) signed 1-reversals. This is precisely what Algorithm 5 does.

Algorithm 5: Algorithm for sorting by short operations
Data: A permutation π ∈ S ± n . Result: Number of short operations applied for sorting π.

Experimental results
We have implemented Algorithms 2 and 5, and we have audited them using GRAAu [31]. The audit consists of comparing the distance computed by an algorithm with the rearrangement distance for every π ∈ S ± n , 1 ≤ n ≤ 10. The results are presented in Tables 1 and 2, where n is the size of the permutations, Avg. Ratio is the average of the ratios between the distance returned by an algorithm and the rearrangement distance, Max. Ratio is the greatest ratio among all the ratios between the distance returned by an algorithm and the rearrangement distance, and Exact is the percentage of distances returned by the algorithm that is exactly the rearrangement distance.
Besides providing the Max. Ratio, GRAAu also provides up to 50 permutations for which the algorithms achieved this ratio. These permutations can be used to obtain lower bounds on the theoretical approximation ratios of Algorithms 2 and 5. This is precisely what Lemmas 23 and 24 do. Observe that, in the case of Algorithm 5, the lower bound matches the upper bound, so we can conclude that its approximation ratio is tight (Lemma 25).

Lemma 25. The approximation ratio of Algorithm 5 is tight.
Proof. Immediate from Theorem 5 and Lemma 24.

Conclusions
In this article, we have presented optimal algorithms for sorting by signed super short reversals and for sorting by signed super short operations, a 5-approximation algorithm for sorting by signed short reversals, and a 3-approximation algorithm for sorting by signed short operations. We have shown that the expected approximation ratio of the 5-approximation algorithm is not greater than 3 for random signed permutations with more than 12 elements. Moreover, the experimental results on small signed permutations have led us to conclude that the approximation ratio of both approximation algorithms cannot be smaller than 3. In particular, this means that the approximation ratio of the 3-approximation algorithm is tight.
We make two remarks. The first remark is that bounding the length of the operations is not the only approach yielded by the assumption that rearrangement events affecting large portions of a genome are less likely to occur. Some researchers [32][33][34] have proposed to assign weights to the operations according to their length. The second remark is that, as opposed to the unbounded variants of the permutation sorting problem, sorting a linear permutation by short operations is not equivalent to sorting a circular permutation by short operations (see [35] for details). To the best of our knowledge, the only bounded variant considered in the literature that involves circular permutations is the problem of sorting an unsigned circular permutation by reversals of length 2. Jerrum [17] and Egri-Nagy et al. [35] demonstrated how to solve this problem in polynomial time.
We see some possible directions for future work. One is to develop polynomial time solutions for the problem of sorting by signed short reversals and for the problem of sorting by signed short operations. Another possibility is to study the problem of sorting signed circular permutations by short operations. In particular, we think that the ideas used to solve the problem of sorting by signed super short reversals can also be used to tackle the problem of sorting a signed circular permutation by reversals of length of at most 2. Finally, one could apply the methods discussed in this work to inferring phylogenies. For instance, Egri-Nagy et al. [35] applied their method (i.e. sorting unsigned circular permutations by reversals of length 2) to reconstruct the phylogenetic history of some published Yersinia genomes. As a result, they produced a phylogenetic tree that is broadly consistent with the phylogenetic tree of Bos et al. [36].