Presentation is loading. Please wait.

Presentation is loading. Please wait.

A Simpler 1.5-Approximation Algorithm for sorting by transposition Tzvika Hartman.

Similar presentations


Presentation on theme: "A Simpler 1.5-Approximation Algorithm for sorting by transposition Tzvika Hartman."— Presentation transcript:

1 A Simpler 1.5-Approximation Algorithm for sorting by transposition Tzvika Hartman

2 Linear and Circular Permutation Linear permutations of {A,B,C,D,E} : [B A E C D],[E C A B D]….. Circular permutation of {A,B,C,D,E} : A C D B E C B A E D

3 Linear and Circular Permutations the number of possible transpositions on a linear n-permutation is C n+1 3 In a circular n-permutation there are only C n 3 possibilities. A D B C E F

4 Sorting by transposition Find a shortest sequence of transpositions

5 Why “ sort ” ? π= “A C D B E” * π=“B D E A C” 1 2 3 4 54 5 2 1 3

6 Breakpoint Graph Definition 1 Let π = (π 1... π n ) be a circular permutation, and f(π) = π =(π 1... π 2n ). The breakpoint graph G(π) is an edge- colored graph on 2n vertices{1, 2,..., 2n}. For every 1 ≤ i ≤ n, π 2i is joined to π 2i+1 by a black edge (denoted by bi), and 2i is joined to 2i + 1 by a gray edge. Black edge: 兩相鄰字元的連結 Gray edge: 連結正確排序中的兩相鄰字元 ()

7 An example of Breakpoint Graph

8 π=“A C D B E” (4 5 2 1 3) 1 4 5 2 3 910 1 2 3 4 5 6 7 8

9 1 4 52 3 12 5 6 3 4 7 8 9 *π=“B D E A C” (1 2 3 4 5)

10 Problem Transformation Input : a permutation Output : a identity permutation Our goal : minimum transposition Input : a breakpoint graph Output : maximum odd cycles (n cycles with one black edge and one gray edge) Our goal : minimum transposition

11 Definition d(π): transposition distance of a permutation G(π): breakpoint graph of π n(π): number of black edges in G(π) c(π): number of cycles in G(π) Length of a cycle: the number of black edges K-cycle: a cycle of length k A odd cycle: k is odd C odd ( π ): number of odd cycle arc: an interval in the cyclic order

12 ∆c(π,τ) = c(τ·π) - c(π), and ∆c odd (π,τ) = c odd (τ·π) - c odd (π). τis a k-transposition if ∆c odd (π,τ) =k

13 Lower bound of d( π ) Lemma 2 For all permutations π and transpositionsτ, it holds that ∆ c(π, τ) belong {-2, 0, 2}, and ∆ c odd (π, τ) belong {-2, 0, 2}. Theorem 3 For all permutations π, d(π) ≧ (n(π) - c odd (π))/2. A transposition create two odd cycle!!

14 Transformation into Equivalent Simple Permutations A k-cycle in the breakpoint graph is called short if k ≦ 3 A breakpoint graph is called simple if it contains only short cycles. A permutation π is called simple if G(π) is simple.

15 (g,b)-split Let b = (v b, w b ) be a black edge and g = (v g, w g ) be a gray edge belonging to the same cycle C = (..., v b, w b,..., w g, v g,...) in G(π). A (g, b)-split of G(π) is a sequence of operations on G(π), resulting in a new graph *G(π) with one more cycle, as follows: – Removing edges b and g. – Adding two new vertices v and w. – Adding two new black edges (v b, v) and (w,w b ). – Adding two new gray edges (w g, w) and (v, v g ).

16 A (g, b)-split is called safe if n(π) - c odd (π) = n(*π) - c odd ( *π) Lemma 5 Every permutation can be transformed into a simple one by safe splits. Lemma 6 Let *π be a simple permutation that is equivalent to π, then every sorting of *π mimics a sorting of π with the same number of operations.

17 Algorithm Sort(π) 1. Transform permutation π into an equivalent simple permutation *π (Lemma 5). 2. While G = G(*π) contains a 2-cycle, apply a 2-transposition (Lemma 7). 3. While G contains an oriented 3-cycle, apply a 2-transposition on it. 4. If two interleaving 3-cycles are found in G, apply a (0, 2, 2 )-sequence (Lemma 8). 5. If a shattered unoriented 3-cycle is found in G, apply a (0, 2, 2)-sequence(Lemma 12). 6. If G contains a cycle of length greater than 1, go to step 4. 7. Mimic the sorting of π using the sorting of *π (Lemma 6). Step2-6 is called Algorithm SortSimple

18 Possible case in Simple permutation (graph) 1-cycle 2-cycle Oriented 3-cycle Unoriented 3-cycle OK!! a 2-transposition Two interleaving 3-cycle Three unoriented 3-cycle (one is shattered by another two) Can’t solve it independently

19 How to deal with unoriented 3-cycle? 4. If two interleaving 3-cycles are found in G, apply a (0, 2, 2 )-sequence (Lemma 8). 5. If a shattered unoriented 3-cycle is found in G, apply a (0, 2, 2)-sequence(Lemma 12). 6. If G contains a cycle of length greater than 1, go to step 4. What we want is interleaving 3-cycles!!

20 Lemma 7 If π is a permutation that contains a 2-cycle, then there exists a 2- transposition on π. Lemma 8 Let π be a permutation that contains two interleaving unoriented 3-cycles. Then, there exists a (0, 2, 2)-sequence of transpositions on π.

21 (0,2,2)-sequence A (0,2,2)-sequence is a sequence of three transpositions, of which the first is a 0-transposition, and the next two are 2-transpositions.

22 Lemma 9 Let C and D be two intersecting unoriented 3-cycles that are not interleaving. Then, there exists a transposition which transforms C and D into a 1-cycle and an oriented 5-cycle.

23 Lemma 10 Let C be an unoriented cycle in G(π), and let bi and b j be black edges of C. Then, (b i, b j ) intersects with some cycle in G(π). Corollary 11 Let π be a simple permutation that contains no 2-cycles, no oriented 3-cycles, and no pair of interleaving 3-cycles. Then, there exists a triple of 3-cycles C,D and E in G(π), such that E is shattered by C and D. Lemma 12 Let π be a permutation that contains three unoriented 3-cycles C,D and E, such that E is shattered by C and D. Then, there exists a (0, 2, 2)-sequence of transpositions on π

24

25 Running Time and Approximation Theorem 13 In this algorithm we only use 2-transposition,(0,2,2)-transposition The 1.5-approximation is hold!! Number of transpositions performed is O(n) Perform a transposition is O(n) Deciding which transposition is applied is constant time Total : O(n 2 )

26 Theorem 14 Algorithm Sort is a 1.5-approximation algorithm for general permutations, and it runs in time O(n2). Proof. By Theorem 13, we are guaranteed that alg(*π) ≤ 1.5 · d(*π), where alg(*π) is the number of transpositions used by Algorithm SortSimple to sort *π. Thus,by Theorem 3


Download ppt "A Simpler 1.5-Approximation Algorithm for sorting by transposition Tzvika Hartman."

Similar presentations


Ads by Google