1 / 31

Efficient Data Structures and a New Randomized Approach for Sorting Signed Permutations by Reversals

Efficient Data Structures and a New Randomized Approach for Sorting Signed Permutations by Reversals. Haim Kaplan and Elad Verbin. Given a permutation, find a shortest sequence of reversals that transforms it to (1 2 … n). Unsigned Sorting by reversals. (. (3 4 2 5 1). 3. 4. 2. 5. 1).

eli
Download Presentation

Efficient Data Structures and a New Randomized Approach for Sorting Signed Permutations by Reversals

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Efficient Data Structures and a New Randomized Approach for Sorting Signed Permutations by Reversals Haim Kaplan and Elad Verbin

  2. Given a permutation, find a shortest sequence of reversals that transforms it to (1 2 … n) Unsigned Sorting by reversals ( (3 4 2 5 1) 3 4 2 5 1)

  3. Signed Sorting by reversals Given a signed permutation, find a shortest sequence of reversals that transforms it to (+1 +2 … +n) ( - - - (3 4 -2 -5 1) 3 4 2 5 1)

  4. (3 4 -2 -5 1) (-4 -3 -2 -5 1) (-4 -3 -2 -1 5) ( 1 2 3 4 5) Example

  5. Motivation • Biology: computing large-scale evolutionary distance (most parsimonious scenario) • Heuristics for TSP

  6. History of Unsigned SBR • 1993: Conjectured to be NP-Hard and 2-approx. algorithm, Kececioglu and Sankoff • 1997: Proven NP-Hard, Caprara • 1999: Proven MAX-SNP Hard, Berman and Karpinski • 2001: 1.375-approximation by Berman, Hannenhalli and Karpinski

  7. History of Signed SBR • 1993: Conjectured NP-Hard, Kececioglu and Sankoff • 1995: Polynomial Algorithm, Pevzner and Hannenhalli • 1996: O(n2(n)) Algorithm, Berman and Hannenhalli • 1997: Simpler O(n2) Algorithm, Kaplan, Shamir and Tarjan - Best to date. • 2001: Very Simple cubic solution, Bergeron

  8. Variants • Computing just the distance (signed version) – linear (Bader et. al., 2001) • Many, many, more

  9. Sorting Signed Permutations

  10. x -x xa,xb xb,xa The Breakpoint Graph +3 +4 -2 -5 +1 0 3a 3b 4a 4b 2b 2a 5b 5a 1a 1b 6 • Transform Permutation • Blue Edges Between Adjacent Vertices • Red Edges Between Consecutive elements

  11. Note: single decomposition to alternating cycles Calculating the distance dist=n+1-c+h+f dist=n+1-c Goal: Find a reversal that creates a cycle and keeps h+f=0 (a safe reversal) h,f are small parameters of the breakpoint graph (usually h+f=0) Eliminated in linear time 0 3a 3b 4a 4b 2b 2a 5b 5a 1a 1b 6

  12. Oriented Edges We consider only reversals that reverse between the endpoints of a red edge Red edges can be : Oriented{ Right-to-Right Left-to-Left Unoriented{ Left-to-Right Right-to-Left Def:This reversal acts on the red edge

  13. Oriented Edges Red edges can be : Unoriented c=0 Oriented c=1 Thm: A reversal acting on a red edge creates a new cycle the edge is oriented

  14. Safe reversals • Safe oriented reversal: does not increase h+f • Theorem(H-P): a permutation with h+f=0 always has a safe oriented reversal (or is id) • SBR algorithms iteratively find a safe reversal. KST does this in linear time (total running time – O(n2)) • H-P characterized safe oriented reversals using the overlap graph

  15. What happens if we disregard safety? perms with h+f>0 are rare

  16. Failed but don’t know it yet Each path is <n+2 steps h+f>0 Yey! Whoops.. id NO CHILDREN RandomWalk =(1 -4 2 -3) H-P: all nodes with no children are either idor red ’s oriented reversals Prop: if we ended up at id, then the sequence was a minimal sorting sequence, otherwise we can retry Prop: oriented reversals never decrease h+f (i.e. red points only to red)

  17. 50% chance of failure 50% chance of failure 50% chance of failure After how many trials will RandomWalk succeed? • Worst permutation – many • Average permutation – very few pi7=(2 4 6 -1 -3 -5 7) • (permutation of Michal Ozery and Ron Shamir) Probability of success

  18. What is the average over all permutations of the expected number of trials until success? • Theoretically – we don’t know (but we do know that red permutations are polynomially rare) • Experimentally – 1.6, regardless of n

  19. Empirical testing of RandomWalk on random permutations (selected uniformly without unoriented components) Behavior of RandomWalk on the average

  20. Implementing the Random Walk

  21. Basic structure • Our DS is based on a simple data structures of • Fredman, Johnson, McGeoch & Hostheimer `95 • (which are based on those by Chrobak, Szymacha • & Krawczyk, `90). These structures were invented • for implementing TSP heuristics • These data structures allow us to maintain • permutation under: • Reversals • Queries: , • All operations taking logarithmic time.

  22. Random Walk • Repeatedly: • Select a random oriented reversal • Perform it and update the permutation

  23. How fast can we run one RandomWalk iteration? Repeatedly: • Select a random oriented reversal • Perform it and update the permutation • Can be done in O(n) time • In the paper we show how to do it in so one Random Walk takes time

  24. Further Questions • Why does RandomWalk work (so well)? • Are there variants of RandomWalk that work better (i.e. have good worst-case behavior – no bad cases)? • Can RandomWalk be easily and efficiently implemented?

  25. Further Questions • Are there variants to RandomWalk that can be easily and efficiently implemented but maintain good average-case behavior (i.e. by waving the demand for a uniform selection of an oriented reversal)? • Can we maintain safety or hurdelity too?

  26. General Further Research • Is there a subquadratic algorithm for SBR? • What is the structure of the space of all sorting reversal sequences? (i.e. the permutation graph we saw before)

  27. Fin.

  28. Fredman et. al.’s DS • Splay tree with the permutation in the leaves – inorder scan gives the permutation. • Reverse bits at the nodes. If on means that the order of the subtree should be reverse, as should the signs of the elements.

  29. Reverse(i,j): Splay operations should keep the invariant that the tree indeed represents the perumutation i j splay(j)

  30. Reverse(i,j): j i splay(i)

  31. Reverse(i,j): i i j k T1 T1 j T2 T3 T2 -j T3 T4 -j -k T1 -i T1 -i T3R T2R T2R T3 T4

More Related