The master ring problem

Similar documents
CS 491G Combinatorial Optimization Lecture Notes

Counting Paths Between Vertices. Isomorphism of Graphs. Isomorphism of Graphs. Isomorphism of Graphs. Isomorphism of Graphs. Isomorphism of Graphs

Mid-Term Examination - Spring 2014 Mathematical Programming with Applications to Economics Total Score: 45; Time: 3 hours

CIT 596 Theory of Computation 1. Graphs and Digraphs

22: Union Find. CS 473u - Algorithms - Spring April 14, We want to maintain a collection of sets, under the operations of:

Solutions for HW9. Bipartite: put the red vertices in V 1 and the black in V 2. Not bipartite!

Lecture 6: Coding theory

The vertex leafage of chordal graphs

I 3 2 = I I 4 = 2A

Necessary and sucient conditions for some two. Abstract. Further we show that the necessary conditions for the existence of an OD(44 s 1 s 2 )

2.4 Theoretical Foundations

18.06 Problem Set 4 Due Wednesday, Oct. 11, 2006 at 4:00 p.m. in 2-106

Graph Algorithms. Vertex set = { a,b,c,d } Edge set = { {a,c}, {b,c}, {c,d}, {b,d}} Figure 1: An example for a simple graph

Factorising FACTORISING.

Global alignment. Genome Rearrangements Finding preserved genes. Lecture 18

Lecture 11 Binary Decision Diagrams (BDDs)

CSE 332. Sorting. Data Abstractions. CSE 332: Data Abstractions. QuickSort Cutoff 1. Where We Are 2. Bounding The MAXIMUM Problem 4

1 PYTHAGORAS THEOREM 1. Given a right angled triangle, the square of the hypotenuse is equal to the sum of the squares of the other two sides.

Graph Theory. Simple Graph G = (V, E). V={a,b,c,d,e,f,g,h,k} E={(a,b),(a,g),( a,h),(a,k),(b,c),(b,k),...,(h,k)}

Monochromatic Plane Matchings in Bicolored Point Set

6. Suppose lim = constant> 0. Which of the following does not hold?

On a Class of Planar Graphs with Straight-Line Grid Drawings on Linear Area

The DOACROSS statement

T b a(f) [f ] +. P b a(f) = Conclude that if f is in AC then it is the difference of two monotone absolutely continuous functions.

Logic, Set Theory and Computability [M. Coppenbarger]

Now we must transform the original model so we can use the new parameters. = S max. Recruits

F / x everywhere in some domain containing R. Then, + ). (10.4.1)

CARLETON UNIVERSITY. 1.0 Problems and Most Solutions, Sect B, 2005

Lecture 2: Cayley Graphs

CS 2204 DIGITAL LOGIC & STATE MACHINE DESIGN SPRING 2014

Proportions: A ratio is the quotient of two numbers. For example, 2 3

for all x in [a,b], then the area of the region bounded by the graphs of f and g and the vertical lines x = a and x = b is b [ ( ) ( )] A= f x g x dx

6.5 Improper integrals

Compression of Palindromes and Regularity.

Part 4. Integration (with Proofs)

arxiv: v2 [math.co] 31 Oct 2016

Metodologie di progetto HW Technology Mapping. Last update: 19/03/09

Analysis of Temporal Interactions with Link Streams and Stream Graphs

Algebra 2 Semester 1 Practice Final

COMPUTING THE QUARTET DISTANCE BETWEEN EVOLUTIONARY TREES OF BOUNDED DEGREE

Vidyalankar S.E. Sem. III [CMPN] Discrete Structures Prelim Question Paper Solution

A Disambiguation Algorithm for Finite Automata and Functional Transducers

COMPUTING THE QUARTET DISTANCE BETWEEN EVOLUTIONARY TREES OF BOUNDED DEGREE

Separable discrete functions: recognition and sufficient conditions

On-Line Construction of Compact Directed Acyclic Word Graphs

Numbers and indices. 1.1 Fractions. GCSE C Example 1. Handy hint. Key point

Tutorial Worksheet. 1. Find all solutions to the linear system by following the given steps. x + 2y + 3z = 2 2x + 3y + z = 4.

Data Structures LECTURE 10. Huffman coding. Example. Coding: problem definition

Exam 1 Study Guide. Differentiation and Anti-differentiation Rules from Calculus I

Surds and Indices. Surds and Indices. Curriculum Ready ACMNA: 233,

Implication Graphs and Logic Testing

Algorithms & Data Structures Homework 8 HS 18 Exercise Class (Room & TA): Submitted by: Peer Feedback by: Points:

C. C^mpenu, K. Slom, S. Yu upper boun of mn. So our result is tight only for incomplete DF's. For restricte vlues of m n n we present exmples of DF's

CS261: A Second Course in Algorithms Lecture #5: Minimum-Cost Bipartite Matching

p-adic Egyptian Fractions

Section 2.3. Matrix Inverses

On the Spectra of Bipartite Directed Subgraphs of K 4

Maximum size of a minimum watching system and the graphs achieving the bound

Computing on rings by oblivious robots: a unified approach for different tasks

Section 2.1 Special Right Triangles

Metaheuristics for the Asymmetric Hamiltonian Path Problem

Eigenvectors and Eigenvalues

Technology Mapping Method for Low Power Consumption and High Performance in General-Synchronous Framework

CS311 Computational Structures Regular Languages and Regular Grammars. Lecture 6

Total score: /100 points

Lecture 8: Abstract Algebra

Technische Universität München Winter term 2009/10 I7 Prof. J. Esparza / J. Křetínský / M. Luttenberger 11. Februar Solution

CS 360 Exam 2 Fall 2014 Name

Obstructions to chordal circular-arc graphs of small independence number

Math 32B Discussion Session Week 8 Notes February 28 and March 2, f(b) f(a) = f (t)dt (1)

Subsequence Automata with Default Transitions

A Primer on Continuous-time Economic Dynamics

Solutions to Problem Set #1

Lecture 4: Graph Theory and the Four-Color Theorem

Laboratory for Foundations of Computer Science. An Unfolding Approach. University of Edinburgh. Model Checking. Javier Esparza

New Expansion and Infinite Series

More Properties of the Riemann Integral

Welcome. Balanced search trees. Balanced Search Trees. Inge Li Gørtz

Finite Automata Theory and Formal Languages TMV027/DIT321 LP4 2018

NON-DETERMINISTIC FSA

Sections 5.3: Antiderivatives and the Fundamental Theorem of Calculus Theory:

Nondeterministic Finite Automata

Mathematical Proofs Table of Contents

Bisimulation, Games & Hennessy Milner logic

Particle Physics. Michaelmas Term 2011 Prof Mark Thomson. Handout 3 : Interaction by Particle Exchange and QED. Recap

Solutions to Assignment 1

Outline Data Structures and Algorithms. Data compression. Data compression. Lossy vs. Lossless. Data Compression

Line Integrals and Entire Functions

Connectivity in Graphs. CS311H: Discrete Mathematics. Graph Theory II. Example. Paths. Connectedness. Example

Discrete Structures Lecture 11

THE EXISTENCE-UNIQUENESS THEOREM FOR FIRST-ORDER DIFFERENTIAL EQUATIONS.

A Lower Bound for the Length of a Partial Transversal in a Latin Square, Revised Version

UNIFORM CONVERGENCE. Contents 1. Uniform Convergence 1 2. Properties of uniform convergence 3

where the box contains a finite number of gates from the given collection. Examples of gates that are commonly used are the following: a b

Hyers-Ulam stability of Pielou logistic difference equation

DIFFERENCE BETWEEN TWO RIEMANN-STIELTJES INTEGRAL MEANS

Project 6: Minigoals Towards Simplifying and Rewriting Expressions

Comparing the Pre-image and Image of a Dilation

Computing the Quartet Distance between Evolutionary Trees in Time O(n log n)

System Validation (IN4387) November 2, 2012, 14:00-17:00

Transcription:

2005 Interntionl Conferene on Anlysis of Algorithms DMTCS pro. AD, 2005, 287 296 The mster ring problem Hs Shhni 1 n Lis Zhng 2 1 Computer Siene Dept., Tehnion, Hif 32000, Isrel. 2 Bell Lbs, Luent Tehnologies, 600 Mountin Ave., Murry Hill, NJ 07974. We onsier the mster ring problem (MRP) whih often rises in optil network esign. Given network whih onsists of olletion of interonnete rings R 1,..., R K, with n 1,..., n K istint noes, respetively, we nee to fin n orering of the noes in the network tht respets the orering of every iniviul ring, if one exists. Our min result is n ext lgorithm for MRP whose running time pprohes Q QK k=1 (n k/ 2) for some polynomil Q, s the n k vlues beome lrge. For the ring lerne problem, speil se of prtil interest, our lgorithm hieves this running time for rings of ny size n k 2. This yiels the first nontrivil improvement, by ftor of (2 2) K (2.82) K, over the running time of the nive lgorithm, whih exhustively enumertes ll Q K k=1 (2n k) possible solutions. Keywors: Mster ring, shortest ommon supersequene, optil networks, ext lgorithms. 1 Introution 1.1 Problem Sttement n Motivtion The prevlene of SONET (Synhronous Optil NETwork) tehnology hs me the ring populr network topology [13]. To rry emn between two noes on SONET ring, trffi is route simultneously lokwise n ounter-lokwise, one s the primry pth n the other s the bkup pth. Often n optil network onsists of olletion of interonnete SONET rings. A mster ring ontins every noe in the network extly one n respets the noe orering of every iniviul SONET ring. The mster ring problem (MRP) is to fin suh ring, whenever it exists. Formlly, the mster ring problem is efine s follows. Suppose tht network onsists of K rings, R 1,..., R K, with n 1,..., n K istint noes, respetively. Eh ring hs two orienttions, lokwise n ounter-lokwise. We sy tht R is subring of M (or M is mster ring of R) if either the lokwise or the ounter-lokwise orienttion of R n be obtine from M by ersing zero or more noes from M. The gol is to fin mster ring whenever it exists. Consier n instne of MRP s shown in Figure 1. The network onsists of 3 rings. R 1 hs the noes bef, R 2 hs the noes hg, n R 3 hs the noes ghi. A possible mster ring is bghefi. g b h i f e Fig. 1: An instne of MRP. There re number of resons for fining mster rings. For exmple, s network evolves with growing trffi, it expns from n initilly smll number of SONET rings, to inlue lrge olletion of rings. Unfortuntely, suh expnsion is often rrie out in n -ho mnner, with iruits e n torn own over time. As result, the network my hve unneessrily omplex topology tht mkes network mngement nightmre. To reple spghetti-like network, one simple topology is mster ring. Sine 1365 8050 2005 Disrete Mthemtis n Theoretil Computer Siene (DMTCS), Nny, Frne

288 Hs Shhni n Lis Zhng mster ring respets the noe orering of every existing SONET ring, it hs the vntge of preserving the routing lbel of every emn intr to n existing SONET ring. Inee, emn my trverse more noes roun the mster ring thn roun its originl SONET ring; however, preserving the orer in whih the SONET noes re trverse llows to effiiently upte the routing tbles, rther thn reefine from srth the Lbel Swithe pths. (Suh pths re use, e.g., in MPLS [14].) Even if the network is not sought to be rebuilt, it still nees to hnle the routine owntime, for purposes suh s softwre upgre. A mster ring n then serve s simple bkup topology. Proviing mster ring (whenever possible) to network mngement system simplifies its opertion n is therefore vluble [12, 1, 2]. We emphsize tht the mster ring n be viewe s logi ring. Tht is, two neighboring noes in the ring o not nee to be physilly onnete by links lrey existing in the network. (Suh links n be e one the mster ring is set s new/bkup topology.) In ition, if two SONET rings R i n R j interset then they hve t lest two noes in ommon. This is beuse two ommon noes n tolerte one noe filure when supporting emn between noe in R i n noe in R j. One onvenient wy to represent the rings is to use sequenes. Eh orienttion of ring with n noes orrespons to n sequenes, epening on the noe with whih the sequene strts. Figure 2 shows the sequene representtion of the instne in Figure 1. For exmple, the ring R 1 in Figure 2 hs 6 lokwise sequenes: bef, bef, efb, efb, efb, fbe n 6 ounter-lokwise sequenes: feb, ebf, bfe, bfe, bfe, feb. We lso refer to eh sequene s n opening of ring. We sy tht S is subsequene of T (or T is supersequene of S) if S n be obtine from T by ersing zero or more symbols from T. Therefore, R is subring of M (or M is mster ring of R) if some sequene tht orrespons to R is subsequene of sequene tht orrespons to M (see Figure 2). f b g i i b e h g h f e h g R1 R2 R3 Mster ring Fig. 2: (Left) Three rings R 1, R 2 n R 3. (Right) A possible mster ring. For exmple, R 1 is subring sine its lokwise sequene bef is subsequene of the sequene bghefi orresponing to the mster ring; R 2 is subring sine its lokwise sequene gh is subsequene; R 3 s ounter-lokwise sequene ghi is subsequene. Given K sequenes, eh with ny symbol ppering t most one, we note tht it is esy to fin supersequene tht ontins eh symbol one, if one exists. We onstrut irete grph G = (V, E), whose vertex set onsists of the symbols in the K sequenes n whose ege set onsists of irete eges of the form (, b), where ppers immeitely before b in sequene. Rell tht topologil sort of igrph is ny liner orer on the verties respeting the grph s prtil orer. Hene, if G is yli then topologil sort of G is (minimum possible length) supersequene of ll K sequenes. Deiing whether igrph is yli n fining topologil sort re polynomilly solvble (see e.g. [4]). Thus, our min tsk is to etermine set of sequenes whih n be represente s n yli igrph (whenever suh set exists). This is the fous of the pper. 1.2 Min Result Our min result (in Setion 2) is n ext lgorithm for MRP, whose running time pprohes Q K k=1 (n k/ 2) for some Q tht is polynomil in the input size, s the n k vlues beome lrge. For the ring lerne problem, speil se of prtil interest, our lgorithm hieves this running time for rings of ny size n k 2 (see in Setion 3). This yiels the first non-trivil improvement, by ftor of (2 2) K 2.82 K, over the nive lgorithm whih exhustively enumertes ll K k=1 (2n k) possible solutions (see, e.g., in [2]). Our lgorithm pplies enumertion guie by n intersetion grph of the network, whih represents

The mster ring problem 289 the interonnetions mong the rings. The grph is use for ientifying subsets of rings whose openings leve only few onsistent openings for ll other rings, thereby eresing the remining number of enumertion steps. While enumertion lone is ineffiient, n using the intersetion grph lone my result in flse solution for our problem (see in Setion 2), we show tht ombining the two yiels signifint improvement in running time, n gurntees tht mster ring will be foun, if one exists. We believe tht similr tehniques n be use in solving extly other relte problems, suh s shortest ommon supersequene (SCS) n feebk r set (FAS) n their vrints. (See in Setion 4.) Ru b Rw u v w b Rv f f e e Fig. 3: (Left) An instne of MRP: R u onsists of noes b, R v onsists of ef n R w onsists of bef. (Mile) The intersetion grph H. (Right) R u, R v n R w inue lrge ring. 2 Algorithm A nive solution for MRP is to enumerte ll possible sequenes for eh ring n fin if there is topologil sort for eh resulting irete grph. Obviously, trying the totl of 1 k K (2n k) possibilities suffies to solve the problem; the running time is P 1 k K (2n k), where P is the polynomil time require for topologil sort. We esribe below n lgorithm whih vois enumerting some of these possibilities, by using the intersetion grph of the network. Before we pply our lgorithm, we first eliminte ll singleton noes from eh ring, i.e. those noes tht pper only in one ring. If noe is singleton, then n be ignore when onstruting the mster ring. Inee, if mster ring exists without, then my lwys be e to the mster ring. From now on we my ssume without of loss of generlity tht every noe ppers in t lest 2 rings. We onstrut n unirete intersetion grph H tht shows how the rings re interonnete. The grph H onsists of K verties, eh orresponing to one of the K rings. If two rings shre ommon noes, then there is n ege between their orresponing verties in H. For lrity, we use verties n eges when referring to the elements in the grph H n noes n links when referring to the elements of ring. We lso use letters ner the beginning of the lphbet (suh s, b, n ) when referring to noes in ring n letters ner the en of the lphbet (suh s u, v n w) when referring to verties in H. For vertex u in H, we use R u to represent the orresponing ring. (See Figure 3 for n exmple.) Our lgorithm is motivte by observtions tht we etil lter. Consier vertex u in H. If R v is lrey opene, n v is neighbor of u, then the number of onsistent openings of R u is limite. (We sy tht set of sequenes re onsistent if they hve supersequene.) For exmple, suppose tht R u n R v hve in ommon the noes n b, n R v orers before b; then, R u woul hve to s well. We note, however, tht even if ny two neighboring rings hve onsistent openings, it oes not neessrily imply onsistent openings for ll rings. Consier the instne of Figure 3. When R u is oriente lokwise, n R v, R w re oriente ounter-lokwise, they inue lrge ring bef. If R u orrespons to the sequene b, R v orrespons to ef, n R w orrespons to efb then no opening of this inue ring ontins the three sequenes s subsequenes. Therefore, these three openings nnot be onsistent with one nother. However, ny two of these openings re onsistent. (See Figure 3, Right). If, inste, R w hs the opening bef, then the three openings re onsistent n hve mster ring bef. The exmple in Figure 3 shows tht we nnot use the grph H lone for etermining goo openings for ll rings, sine this grph inites only the lol epenenies mong the rings. To gurntee tht no inue rings remin in the network fter we open R 1,..., R K, we use the properties of the grph H only s guine for the lgorithm.

290 Hs Shhni n Lis Zhng Algorithm A MR 0 Eliminte singleton noes from R 1,..., R K. Construt the grph H with vertex set V. Phse 1. Low-egree verties 1 N = L =. 2 While there is low-egree vertex v V L N vertex v to set L n its neighbors to set N. 3 For u N, try ll possible sequenes for R u. 4 For v L with x neighbors, try t most x possible sequenes for R v. (See Lemm 1.) Phse 2. Dominting set 5 Fin ominting vertex set D for the verties v H suh tht v V L N. 6 For u D, try ll possible sequenes for R u. Phse 3. Remining verties 7 Let C = V L N D. 8 For u C, try totl of y C ombintions of sequenes for R u, where y is given in Lemm 5. 9 For eh ombintion of sequenes for verties in N L D C, fin supersequene T using topologil sort. 10 If T exists, mster ring is foun. Algorithm termintes. 11 Output no mster ring exists. Fig. 4: The mster ring lgorithm A MR. In our lgorithm, A MR, we ientify low-egree vertex u in H n enumerte ll possible openings of u s neighbors. Sine u hs low egree, reltively few rings re opene, but this rmtilly limits the number of onsistent openings of R u. (See Lemm 1.) When H hs only high-egree verties, we fin ominting set, where ominting set onsists of verties tht re neighbors to every vertex not in the set. We n fin smll ominting set in grph with high egree verties. By enumerting ll possible openings for the (smll number of) verties in the ominting set, we n reue the number of onsistent openings for eh remining vertex by onstnt ftor. (See Lemm 5.) In our lgorithm we efine low n high egree verties through prmeter δ; we set δ = log n/, where 3 is some onstnt. If vertex u H hs egree lower thn δ then u is low-egree vertex. A pseuooe of lgorithm A MR is given in Figure 4. 3 Anlysis For simpliity of exposition, we ssume throughout the nlysis tht ll of the rings re of the sme size, n. Lter, we show how the nlysis extens to rings of rbitrry sizes. In the following we show the orretness of lgorithm A MR. Certinly, if the lgorithm fins sequene T tht is supersequene for some opening of every ring R k, where 1 k K, the mster ring n be efine by T. However, sine our lgorithm oes not exhustively enumerte ll of the 2n openings of eh ring, if it oes not fin supersequene we nee to verify tht we hve not misse ny opening tht oul hve le to supersequene. We strt by nlyzing the first phse. Lemm 1 If vertex v L hs x neighbors in H, n eh neighbor is opene (i.e. is given sequene), then t most x sequenes of v n be onsistent with the x neighboring sequenes. Proof: Let u be neighbor of v n S u be the sequene representing the opening of the ring R u. Consier the subsequene T u of S u tht onsists of the noes ommon to R u n R v. Let u be the first symbol in T u. Sine we hve no singleton noes, we know tht u T u ontins ll the noes in R v. Therefore, if S v begins with noe in T u for some neighbor u, then S v hs to begin with u ; otherwise, S v nnot be onsistent with S u. Furthermore, if S v strts with u it hs to follow the iretion itte by T u. If T u

The mster ring problem 291 onsists of 3 or more noes, then this iretion is unique. If T u onsists of 2 noes, then either lokwise or ounter-lokwise iretion oul be onsistent. We exmine the two neighboring noes b n of u on ring R u tht re not in T u. For S v to strt t u n ontinue with b, b hs to be the first noe in some other subsequene T u for some neighbor u, or S v nnot be onsistent with S u. In ition, if both b n re the first noes of some subsequenes, no mtter whih iretion S v tkes, S v nnot be onsistent with both. Therefore, S v n only strt with one of t most x noes n for eh strting noe there is only one possible iretion. From Lemm 1, in Line 4 of the lgorithm we try t most δ sequenes for ny ring R v, suh tht v is low-egree vertex in H. This llows us to boun the running time of Phse 1. Lemm 2 The running time of Phse 1 is t most (1 + o(1)) where ˆk = L + N is the totl 2ˆk( 2) number of verties elt with in this phse. Proof: It is esy to see tht the number of ombintions tht Phse 1 tries is boune by (2n) N x L, where x δ. However, to exeute Line 4 we nee to etermine the orienttion for eh of the x potentil openings of ring. This n be one in time O(αx L ) for some onstnt α using the proeure esribe in Lemm 1. Therefore, the outer loop in our lgorithm, Phse 1, tkes t most (2n) N (αx L + x L ), whih is (1 + o(1))(2n) N δ L. Note tht the o(1) term is funtion of the ring size n n, Let us look t the running time more losely. Let ˆk = L + N be the totl number of verties hnle in Phse 1. Sine L onsists of verties with egree lower thn δ, we hve L ˆk/δ n N ˆk(1 1/δ). Therefore, (2n) N δ L = n L + N ( δ n ) L 2 N nˆk nˆk ( )ˆk/δ δ 2ˆk(1 1 δ ) = nˆk2ˆk( logδ δ ) 2ˆk(1 1 δ ) nˆk n. 2ˆk( 2) Let us boun the size of the ominting set D in Phse 2. Lemm 3 D V L N 1+ln(1+δ) 1+δ. Proof: We first prove the next lim, whih generlizes result in [3]. Let G = (V, E) be grph, suh tht ll the verties in V V hve egree t lest s. Then there exists subset of verties V V of size t most V 1+ln(1+s) 1+s, suh tht U = (V \ V ) V is ominting set for G. Consier the following Greey lgorithm. (i) We strt by ing ll the verties in V \V to U. (ii) Let W be the set of verties in V tht re not in U n o not hve neighbor in U; While W > V /(s+1) o: Fin vertex v W suh tht v hs mximl number of neighbors in W ; v to U. (iii) A the verties in W to U. Clerly, U is ominting set for G. To boun the size of V, we first note tht, by n verging rgument, sine ll the verties in V \V re e to U, the number of itertions until W V /(s+1) is t most V ln(s+1)/(s+1). (A similr rgument is given in the nlysis of the eterministi lgorithm for the ominting set problem in [3]; we omit the etils.) Hene, we get tht V V ln(s + 1)/(s + 1) + V /(s + 1). If we set V = V N L n s = δ, our lemm follows iretly. The greey lgorithm in Lemm 3 tkes time t most qurti in K, the number of verties in H. Hene, Lemm 4 The running time of Phse 2 is poly(k) + (2n) D. We now isuss how to effiiently fin openings for the remining verties in C uring Phse 3. Lemm 5 The running time of Phse 3 is t most poly(k)y C, where y 2(3 + n/2). Hene, the running time of phse 3 is poly(k)(n/ 2) C. Proof: During Phse 3, every vertex u C hs some neighbor v in the ominting set D. By ssumption, R u n R v hve t lest 2 noes, sy n b, in ommon. Any sequene of R v efines n orering of n b, i.e. ppers before b or fter b. Among the 2n sequenes of R u, extly n respet this orering of n b. Any of the other n sequenes tht isrespet the orering nnot proue topologil sort n therefore nee not be onsiere. We get tht it suffies to enumerte t most n sequenes for the ring R u, for ny u C.

292 Hs Shhni n Lis Zhng We n further reue the number of enumertions using the piring lgorithm esribe below. Inste of iretly enumerting n possible sequenes for R u where u C, we pir up the sequenes so tht one sequene in pir begins with noe, sy, n the other sequene in the pir ens with the noe. We refer to s the pivot of the pir. (At most 3 out of the n sequenes nnot be pire up with nother sequene.) More onretely, let us onsier the following exmple. For u C, suppose the ring R u hs 6 noes bef lokwise. Suppose tht u s neighbor v D hs hosen sequene for R v in whih b preees e. Therefore, ny sequene for R u nees to hve b before e, else there is no topologil sort. Among the 12 possible sequenes for R u, the following 6 hve b before e. bef bef f be bf e bf e bf e We pir up the 1st n 2n sequenes, bef n bef, with pivot, n pir up the 4th n 5th sequenes, bfe n bfe with pivot. The 3r sequene, fbe, n the 6th sequene, bfe, remin singletons. We first enumerte the 3 + n/2 groups (t most n/2 pirs n t most 3 unpire singletons) for every u C. This gives totl of t most (3 + n/2) C possibilities. In the following we show tht to etermine the tul sequene within eh pir for ny u C, we o not nee to try both possibilities. In ft, totl of 2 C /2 trils suffies. Hene, the totl number of trils is (3 + n/2) C 2 C /2, whih implies y 2(3 + n/2). For exmple, suppose ring R u where u C hs the bove 6 possibilities n we re onsiering the first pir with pivot. Sine is not singleton noe, neessrily ppers in nother ring, sy R w. If the sequene for R w is eie, then we neessrily know whih sequene, bef or bef, woul be goo. This is beuse R u n R w must shre noe other thn n let s ll this noe. Sine is pivot for R u, if ppers before for R w then only the first sequene bef n be goo; if ppers fter for R w then only the seon sequene bef n be goo. v u u Fig. 5: Exmples of the grph F. One possible solution for the grph on the left (right) is to irle the vertex u n mrk ll other verties ross. If vertex v in the mile grph is not in C then neither vertex is irle. In generl, we onstrut irete grph F where eh vertex orrespons to vertex in C. We put irete ege from u to w if the pivot of u is vertex in the ring R w. If there re multiple suh rings R w for u we hoose n rbitrry one. As rgue bove, if there is irete ege from u to w, then we only nee to enumerte the two hoies in hosen pir for R w n n the hoie for R u is implie. We etermine whih rings to enumerte s follows. We mrk ross on vertex to inite tht the hoie is implie n we mrk irle on vertex to inite tht we enumerte both possibilities. Initilly, we mrk ross on vertex u if it hs no outgoing eges. This mens the pivot of u ppers in some ring R w tht belongs to L N D. Hene, the sequene for R w is lrey hosen n therefore the sequene for R u is implie. For eh vertex u in F tht is not yet mrke, we follow the irete eges, strting from u, until (i) we hve rehe mrke vertex (either with irle or with ross), or (ii) we stop right before the pth from u intersets itself, i.e., in vertex z suh tht there is n ege (z, u). In the ltter se, we irle the vertex where we stop. In both ses, we lso mrk ross on every (unmrke) vertex long the pth. (See Figure 5.) It is esy to verify tht the hoie for eh vertex with ross n be implie from the hoie for some vertex with irle. In terms of the running time, we observe tht t most hlf of the verties in F n be irle, sine eh irle vertex nees t lest one istint vertex tht hs ross. To mrk eh vertex in F with irle or ross requires visiting eh vertex one. Hene, the time requirement is liner in C. It follows tht the running time of Phse 3 is t most poly( C )(3 + n/2) C 2 C /2, whih is poly(k)(n/ 2)) C. From Lemms 1 n 5 we see tht lthough lgorithm A MR oes not enumerte ll possibilities for the

The mster ring problem 293 verties in L n C we o not miss out ny potentilly goo opening. Our lgorithm is therefore orret. We boun the running time s follows. Theorem 6 When the ring sizes n gets lrge, the running time of our lgorithm A MR is (1+o(1))(n/ 2) K P Q, where P is the time neee for topologil sort of K sequenes of length n, n Q is polynomil in K. Proof: It is esy to see tht the overll running time is the prout of the running times of the three phses n P, the time for eh topologil sort. From Lemms 2, 4 n 5, the overll running time is, We hve, n L + N (1 + o(1)) 2 (poly(k) + ( L + N )( 2) (2n) D ) (poly(k)(n/ 2) C ) P. n L + N 2 ( L + N )( 2) (2n) D (n/ 2) C nk 2 1 K/2 2 ( L + N )( 2.5) 2. 3 D /2 When the ring size n gets lrge, the vlue of δ is lrge n hene the size of the ominting set D pprohes smll onstnt. When > 2.5, the exponent of the seon term in the bove enomintor is positive. Hene, the bove expression pprohes (n/ 2) K. Therefore the overll running time of lgorithm A MR is (1 + o(1))(n/ 2) K P Q. We note tht the nive lgorithm tht enumertes ll 2n possibilities for eh ring tkes (2n) K P time. Our lgorithm essentilly improves the term (2n) K to (n/ 2) K. Our lgorithm hieves better running time for two importnt sublsses of inputs. Consier the sublss of sprse inputs: in the intersetion grph of the rings, H, ll the verties re of low-egree. Thus, our lgorithm termintes fter Phse 1. The following omes iretly from Lemm 2. Corollry 7 For ny 3, if the mximl egree in H is smller thn log n/ then the running time of the lgorithm is t most (1 + o(1))( n 2 ) K. In prtiulr, if the mximl egree in H is some onstnt 2 1 then the running time of A MR is (1 + o(1))(n 1 1 ) K. Consier now the sublss of ense inputs, where eh noe in the network ppers in t lest m rings, for some m 2; then, in Phse 3 of our lgorithm, we get tht the remining rings n be groupe to lusters of size t lest m. In eh luster we nee to try the two possible openings of single ring. (We use s before the lgorithm of Phse 3, with slight moifitions. We give the etils in the full version of the pper.) This reues the running time of Phse 3 to poly(k)(3 + n 2 ) C 2 C m. Corollry 8 If eh noe in the network ppers in t lest m rings, for some m 2, then the running n time of the lgorithm is t most (1 + o(1))( 2 (1 1 m ) )K. Ring Clerne. In the ring lerne problem, we nee to ler R 1 n reroute ll the trffi through the other rings. In orer for suh trnsition to our, it is ssume tht R 1 intersets with eh of the other rings. In other wors in the intersetion grph H every vertex is neighbor of the vertex w orresponing to R 1. Hene, {w} is ominting set for ll verties in H. We only nee to pply Phse 3 of our lgorithm. Using the simple nlysis in Lemm 3, it is esy to see tht ny opening of R 1 limits the number of openings of ny other ring to t most n. If we follow the more sophistite piring rgument in Lemm 3 we only nee to try totl of (n/ 2) K possibilities. Corollry 9 The lgorithm solves the ring lerne problem in t most (n/ 2) K P Q steps, for rings of ny length n 2. Rings of istint lengths. The nlysis for the se where eh ring R u hs istint size, n u, is similr. We remove the singleton noes n rete the intersetion grph H s before. For Phse 1, we sy tht vertex u hs low egree if it hs fewer thn δ u = log n u / neighbors. The running time of Phse 1 is t most (1 + o(1)) u N (2n u) u L δ u. Similr to Lemm 2 we eue, u ) u N(2n u L N δ u n u 2. ( L + N )( 2) u L In Phse 2, we fin gin ominting set D n we n boun D by V L N 1+ln(1+δ) 1+δ, where δ = min u δ u. When ll ring sizes n u get lrge, the size of D pprohes smll onstnt. The running

294 Hs Shhni n Lis Zhng time for Phse 2 is poly(k)+ u D (2n u). Finlly, for Phse 3 we use the piring lgorithm s esribe in Lemm 5 for the verties in C, n the running time is poly(k) u C (n u/ 2). Theorem 10 For rings with istint sizes, when the ring sizes get lrge the running time of lgorithm A MR is (1 + o(1)) u (n u/ 2) P Q, where the o(1) term is funtion of the ring sizes n, P is the time neee for topologil sort of K sequenes, n Q is polynomil in K. 4 Reltion to Other Problems We briefly isuss how MRP reltes to the shortest ommon supersequene (SCS) n feebk r set (FAS) problems. We efer the etils of this setion to the full version. 4.1 Shortest Common Supersequene In SCS we re given K strings, S = {S 1,..., S K }, of lengths n 1,..., n K, over n lphbet Σ, where Σ = N. We seek supersequene T for S of minimum length. MRP efines the following nturl vrint of SCS. A two-wy yli permuttion of string llows yli shifts of the string in the forwr n reverse iretions. For exmple, the string b hs 4 forwr shifts, b, b, b n b, n 4 reverse shifts, b, b, b n b. In the two-wy yli SCS (2Cyli-SCS) problem, we seek string T of minimum length, suh tht there exists two-wy yli permuttion of eh string S 1,..., S K in S tht is subsequene of T. We sy tht T is 2yli supersequene for S. A supersequene T of length N orrespons to mster ring for the set of rings efine by S 1,..., S K. The SCS problem is known to be hr to pproximte. In prtiulr, Jing n Li [10] showe tht there exists onstnt ε > 0 suh tht if SCS hs polynomil time pproximtion lgorithm with rtio log ε K, then NP is ontine in DTIME(2 polylog(k) ). The best known pproximtion rtio is K+3 4, ue to Frser n Irving [7]. Mienorf onsiere in [11] number of vrints of SCS. This inlues the Cyli-SCS problem, in whih the strings in S n be ylilly permute in the sme iretion. The pper shows tht this problem is NP-hr. (Cyli-SCS solves MRP in the se where eh ring hs fixe orienttion.) On the other hn, Permuttion-SCS, where eh string S k n be permute to ny one of the n k! possibilities, is shown in [11] to be polynomilly solvble for strings of ny length. This implies tht MRP n be solve in polynomil time for inputs where n k 3, for 1 k K. The hrness of 2Cyli-SCS n be shown vi reution from the vertex over problem. Theorem 11 Given m, it is NP-hr to etermine if 2Cyli-SCS hs solution t most m. Our lgorithm, A MR, n be ombine with ynmi progrmming lgorithm for SCS [6, 9, 5] to yiel n optiml solution for 2Cyli-SCS with running time of O(N 2 K K k=1 n2 k ). Alterntively, we n fin supersequene T of minimum length by guessing first the yli shift of eh string in T ; we n then solve the SCS problem using ynmi progrmming (see, e.g. [6]). The best known DP lgorithm hs running time O( K k=1 n k). Thus, we hve, K k=1 Theorem 12 The 2Cyli-SCS problem n be solve in O( n2 k ) steps. 2 K/2 4.2 Feebk Ar Set MRP reltes lso to the feebk r set (FAS) problem in irete grphs, whih is known to be NPhr [8]. Consier the speil se of MRP in whih the orienttion for eh of the rings is given. We enote this oriente version MRP O. We n view MRP O s the following vrint of FAS, tht we ll ext subset FAS. We hve irete grph G = (V, E), n set of K (irete) yles in G, R = {R 1,..., R K }. Let G = (V, E ) be the subgrph inue by the verties n eges in R. We seek subset of K eges in E whose eletion leves G yli, suh tht in eh of the yles R 1,..., R K we omit extly one ege. Suh subset of verties exists iff we hve solution for the orresponing MRP O instne. Sine we re given the orienttion for eh of the rings, we n pply only Phse 3 of lgorithm A MR. By fining mster ring, we solve the ext subset FAS problem. Hene, we hve Corollry 13 For ny K 1 n n k 2, for ll 1 k K, ext subset FAS on the subgrph G inue by K yles of the lengths n 1,..., n K n be solve in P ( K k=1 n k/( 2) K ) steps, where P is polynomil of K.

The mster ring problem 295 5 Open Problems Consier the following prmeterize version of the Permuttion-SCS. Eh string S k, 1 k K, is ssoite with subset of permuttions, Π k, n we seek supersequene T of minimum length, suh tht there exists permuttion of S k in Π k tht is subsequene of T. We ll this problem Perm-SCS(Π k ). Inee, the Cyli-SCS problem is speil se of this problem, in whih Π k is the set of n k yli shifts of S k, in single iretion. As shown in [11], this speil se of the problem is NP-hr. We hve shown (in Theorem 11) tht if we exten the permuttion sets in the Cyli-SCS, so tht Π k is the set of yli shifts in two iretions (2Cyli-SCS), the problem remins NP-hr. On the other hn, when Π k is the set of ll possible permuttions of S k (Permuttion-SCS), the problem is solvble in polynomil time [11]. Determining whether Perm-SCS(Π k ) is polynomilly solvble on other lsses of inputs remins n open problem. Finlly, nturl vrint of MRP whih is of prtil interest, is to ientify mximum subset of rings for whih we n fin mster ring, in ny given network. Aknowlegements We thnk n nonymous referee for helpful omments on the pper. Referenes [1] S. Ahry, B. Gupt, P. Risboo, A. Srivstv. Hitless Network Engineering of SONET Rings, Globeom 2003. [2] S. Ahry, B. Gupt, P. Risboo, A. Srivstv. In-servie Optimiztion of stke SONET Rings, submitte. [3] N. Alon n J. H. Spener. The Probbilisti Metho, Seon Eition. Wiley-Intersiene, 2000. [4] T. H. Cormen, C. E. Leiserson, R. L. Rivest n C. Stein, Introution to Algorithms, 2n Eition, MIT Press n MGrw-Hill, 2002. [5] D. E. Foulser, M. Li n Q. Yng, A Theory of Pln Merging, Artifiil Intelligene, 57, 1992, pp. 143 181. [6] C. B. Frser, subsequenes n Supersequenes of Strings. Ph.D. Thesis, Dept. of Computer Siene, University of Glsgow, 1995. [7] C. B. Frser n R. W. Irving, Approximtion lgorithms for the shortest ommon supersequene, Nori J. Comp. 2, 1995, pp. 303 325. [8] M.R. Grey n D.S. Johnson. Computers n Intrtbility: A Guie to the Theory of NP-Completeness. W.H. Freemn, 1979. [9] S.Y. Itog, The String Merging Problem, BIT, 21, 1981, pp.20 30. [10] T. Jing n M. Li, On the Approximtion of Shortest Common Supersequenes n Longest Common Subsequenes, SIAM Journl on Computing, 24(5), Otober 1995, pp. 1122 1139. [11] M. Mienorf, More on the omplexity of ommon superstring n supersequene problems, Theoretil Computer Siene 125 (1994), 205-228. [12] Mobius network mngement n optimiztion systems. Luent Tehnologies Proprietry. Internl website: http://www-zoo.reserh.bell-lbs.om/ mobius/. [13] R. Rmswmi n K. Sivrjn. Optil networks: prtil perspetive. (Morgn Kufmnn Publishers In., Sn Frniso, 1998). [14] E. Rosen n A. Viswnthn Internet Stnrs for Multi Protool Lbel Swithing. In http://www.ietf.org/rf/rf3031.txt

296 Hs Shhni n Lis Zhng