Symposium on Thortil Aspts of Computr Sin 2008 (Borux), pp. 361-372 www.sts-onf.org rxiv:0802.2867v1 [s.ds] 20 F 2008 FIXED PARAMETER POLYNOMIAL TIME ALGORITHMS FOR MAXIMUM AGREEMENT AND COMPATIBLE SUPERTREES VIET TUNG HOANG 1,2 AND WING-KIN SUNG 1,2 1 Dprtmnt of Computr Sin, Ntionl Univrsity of Singpor E-mil rss: {hongvi2,ksung}@omp.nus.u.sg 2 Gnom Institut of Singpor Astrt. Consir st of lls L n st of trs T = {T (1),T (2),...,T (k) } whr h tr T (i) is istintly lf-ll y som sust of L. On funmntl prolm is to fin th iggst tr (not s suprtr) to rprsnt T whih minimizs th isgrmnts with th trs in T unr rtin ritri. This prolm fins pplitions in phylogntis, ts, n t mining. In this ppr, w fous on two prtiulr suprtr prolms, nmly, th mximum grmnt suprtr prolm (MASP) n th mximum omptil suprtr prolm (MCSP). Ths two prolms r known to NP-hr for k 3. This ppr givs th first polynomil tim lgorithms for oth MASP n MCSP whn oth k n th mximum gr D of th trs r onstnt. 1. Introution Givn st of lls L n st of unorr trs T = {T (1),...,T (k) } whr h tr T (i) is istintly lf-ll y som sust of L. Th suprtr mtho tris to fin tr to rprsnt ll trs in T whih minimizs th possil onflits in th input trs. Th suprtr mtho fins pplitions in phylogntis, ts, n t mining. For instn, in th Tr of Lif projt [10], th suprtr mtho is th si tool to infr th phylognti tr of ll spis. Mny suprtr mthos hv n propos in th litrtur [2, 5, 6, 8]. This ppr fouss on two prtiulr suprtr mthos, nmly th Mximum Agrmnt Suprtr (MASP) [8] n th Mximum Comptil Suprtr (MCSP) [2]. Both mthos try to fin onsnsus tr with th lrgst numr of lvs whih n rprsnt ll th trs in T unr rtin ritri. (Pls r Stion 2 for th forml finition.) MASP n MCSP r known to NP-hr s thy r th gnrliztion of th Mximum Agrmnt Sutr prolm (MAST) [1, 3, 9] n th Mximum Comptil Sutr prolm (MCT) [7, 4] rsptivly. Jnsson t l. [8] prov tht MASP rmins NP-hr vn if vry tr is root triplt, i.., inry tr of 3 lvs. For k = 2, Jnsson t l. [8] n Brry n Niols [2] propos linr tim lgorithm to trnsform MASP n MCSP for 2 input trs to MAST n MCT rsptivly. For k 3, positiv 1998 ACM Sujt Clssifition: Algorithms, Biologil omputing. Ky wors n phrss: mximum grmnt suprtr, mximum omptil suprtr. Hong n Sung CC Crtiv Commons Attriution-NoDrivs Lins
362 HOANG AND SUNG Root Unroot MASP for k trs of mx gr D O((kD) kd+3 (2n) k ) O((kD) kd+3 (4n) k ) MCSP for k trs of mx gr D O(2 2kD n k ) O(2 2kD n k ) O ( k(2n 2 ) ) 3k2 [8] MASP/MCSP for k inry trs O(8 k n k ) [6] O(6 k n k ) Tl 1: Summry of prvious n nw rsults ( stns for nw rsult). rsults for omputing MASP/MCSP r rport only for root inry trs. Jnsson t l. [8] gv n O ( k(2n) 3k2 ) tim solution to this prolm. Rntly, Guillmot n Brry [6] furthr improv th running tim to O(8 k n k ). In gnrl, th trs in T my not inry nor root. Hn, Jnsson t l. [8] post n opn prolm n sk if MASP n solv in polynomil tim whn k n th mximum gr of th trs in T r onstnt. This ppr givs n ffirmtiv nswr to this qustion. W show tht oth MASP n MCSP n solv in polynomil tim whn T ontins onstnt numr of oun gr trs. For th spil s whr th trs in T r root inry trs, w show tht oth MASP n MCSP n solv in O(6 k n k ) tim, whih improvs th prvious st rsult. Tl 1 summrizs th prvious n nw rsults. Th rst of th ppr is orgniz s follows. Stion 2 givs th forml finition of th prolms. Thn, Stions 3 n 4 sri th lgorithms for solving MCSP for oth root n unroot ss. Finlly, Stions 5 n 6 til th lgorithms for solving MASP for oth root n unroot ss. Proofs omitt u to sp limittion will ppr in th full vrsion of this ppr. 2. Prliminry A phylognti tr is fin s n unorr n istintly lf-ll tr. Givn phylognti tr T, th nottion L(T) nots th lf st of T, n th siz of T rfrs to L(T). For ny ll st S, th rstrition of T to S, not T S, is phylognti tr otin from T y rmoving ll lvs in L(T) S n thn supprssing ll intrnl nos of gr two. (S Figur 1 for n xmpl of rstrition.) For two phylognti trs T n T, w sy tht T rfins T, not T T, if T n otin y ontrting som gs of T. (S Figur 1 for n xmpl of rfinmnt.) Mximum Comptil Suprtr Prolm: Consir st of k phylognti trs T = {T (1),...,T (k) }. A omptil suprtr of T is tr Y suh tht Y L(T (i) ) T (i) L(Y) for ll i k. Th Mximum Comptil Suprtr Prolm (MCSP) is to fin omptil suprtr with s mny lvs s possil. Figur 2 shows n xmpl of omptilsuprtry oftworootphylogntitrst (1) nt (2). Ifllinputtrshv th sm lf sts, MCSP is rfrr s Mximum Comptil Sutr Prolm (MCT). Mximum Agrmnt Suprtr Prolm: Consir st of k phylognti trs T = {T (1),...,T (k) }. An grmnt suprtr of T is tr X suh tht X L(T (i) ) = T (i) L(X) for ll i k. Th Mximum Agrmnt Suprtr Prolm (MASP) is to fin n grmnt suprtr with s mny lvs s possil. Figur 2 shows n xmpl of n
FIXED PARAMETER POLYNOMIAL TIME ALGORITHMS FOR MASP AND MCSP 363 T T T Figur 1: Thr root trs. A tr T, tr T suh tht T = T {,,}, n tr T suh tht T T. grmnt suprtrx of two rootphylognti trs T (1) nt (2). Ifll inputtrs hv th sm lf sts, MASP is rfrr s Mximum Agrmnt Sutr Prolm (MAST). T (1) T (2) X Y Figur 2: An grmnt suprtr X n omptil suprtr Y of 2 root phylognti trs T (1) n T (2). In th following isussion, for th st of phylognti trs T = {T (1),...,T (k) }, w not n = i=1..k L(T (i) ), n D stns for th mximum gr of th trs in T. W ssum tht non of th trs in T hs n intrnl no of gr two, so tht h tr ontins t most n 1 intrnl nos. (If tr T (i) hs som intrnl nos of gr two, w n rpl it y T (i) L(T (i) ) in linr tim.) 3. Algorithm for MCSP of root trs Lt T st of k root phylognti trs. This stion prsnts ynmi progrmming lgorithm to omput th siz of mximum omptil suprtr of T in O ( 2 2kD n k) tim. Th mximum omptil suprtr n otin in th sm symptoti tim oun y ktrking.
364 HOANG AND SUNG For vry omptil suprtr Y of T, thr xists inry tr tht rfins Y. This inry tr is lso omptil suprtr of T, n is of th sm siz s Y. Hn in this stion, vry omptil suprtr is impliitly ssum to inry. Dfinition 3.1 (Cut-sutr). A ut-sutr of tr T is ithr n mpty tr or tr otin y first slting som sutrs tth to th sm intrnl no in T n thn onnting thos sutrs y ommon root. Dfinition 3.2 (Cut-suforst). Givn st of k root (or unroot) trs T, utsuforst of T is st A = {A (1),...,A (k) }, whr A (i) is ut-sutr of T (i) n t lst on lmnt of A is not n mpty tr. T (1) T (2) A (1) A (2) f f Figur 3: A ut-suforst A of T. For xmpl, in Figur 3, {A (1),A (2) } is ut-suforst of {T (1),T (2) }. Lt O not th st of ll possil ut-suforsts of T. Lmm 3.3. Thr r O ( 2 kd n k) iffrnt ut-suforsts of T. Proof. W lim tht h tr T (i) ontriuts 2 D n or fwr ut-sutrs; thrfor thr r O ( 2 kd n k) ut-suforsts of T. At h intrnl no v of T (i), sin th gr of v os not x D, w hv t most 2 D wys of slting th sutrs tth to v to form ut-sutr. Inluing th mpty tr, th numr of ut-sutrs in T (i) nnot go yon (n 1)2 D +1 < 2 D n. Figur 4 monstrts tht omptil suprtr of som ut-suforst A of T my not omptil suprtr of T. To irumvnt this irrgulrity, w fin m suprtr s follows. Dfinition 3.4 (Em suprtr). For ny ut-suforst A of T, tr Y is ll n m suprtr of A if Y is omptil suprtr of A, n L(Y) L(T (i) ) L(A (i) ) for ll i k. Not tht omptil suprtr of T is lso n m suprtr of T. For h ut-suforst A of T, lt msp(a) not th mximum siz of m suprtrs of A. Our im is to omput msp(t ). Blow, w first fin th rursiv qution for omputing msp(a) for ll ut-suforsts A O. Thn, w sri our ynmi progrmming lgorithm. W prtition th ut-suforsts in O into two lsss. A ut-suforst A of T is trminl if h lmnt A (i) is ithr n mpty tr or lf of T (i) ; it is ll non-trminl, othrwis.
FIXED PARAMETER POLYNOMIAL TIME ALGORITHMS FOR MASP AND MCSP 365 T (1) T (2) A (1) Z Y A (2) Figur 4: Consir T = {T (1),T (2) } n its ut-suforst A = {A (1),A (2) }. Although Z is omptil suprtr of A, it is not omptil suprtr of T. Th mximum omptil suprtr of T is Y tht ontins only 2 lvs. For h trminl ut-suforst A, lt Λ(A) = {l } L(A (j) ) l L(T (i) ) L(A (i) ) for i = 1,2,...,k. (3.1) j=1..k For xmpl, with T in Figur 2, if A (1) n A (2) r lvs ll y n rsptivly thn Λ(A) = {}. In Lmm 3.5, w show tht msp(a) = Λ(A). Lmm 3.5. If A is trminl ut-suforst thn msp(a) = Λ(A). Proof. Consir ny m suprtr Y of A. By Dfinition 3.4, vry lf of Y longs to Λ(A). Hn th vlu msp(a) os not x Λ(A). It rmins to giv n xmpl of som m suprtr of A whos lf st is Λ(A). Lt C root trpillr 1 whos lf st is Λ(A). Th finition of Λ(A) implis tht L(C) L(T (i) ) L ( A (i)) for vry i k. Sin h A (i) hs t most on lf, it is strightforwr tht C is omptil suprtr of A. Hn C is th sir xmpl. Dfinition 3.6 (Biprtit). Lt A ut-suforst of T. W sy tht th ut-suforsts A L n A R iprtition A if for vry i k, th trs A (i) L n A(i) R n otin y (1) prtitioning th sutrs tth to th root of A (i) into two sts S (i) L n S(i) R ; n (2) onnting th sutrs in S (i) L (rsp. S(i) R ) y ommon root to form A(i) L (rsp. A(i) R ). Figur 5 shows n xmpl of th pring finition. For h non-trminl utsuforsta, w omputmsp(a) s on th msp vlus of A L n A R for h iprtit (A L,A R ) of A. Mor prisly, w prov tht msp(a) = mx{msp(a L )+msp(a R ) A L n A R iprtition A}. (3.2) Th intity (3.2) is thn stlish y Lmms 3.8 n 3.10. Lmm 3.7. Consir iprtit (A L,A R ) of som ut-suforst A of T. If Y L n Y R r m suprtrs of A L n A R rsptivly thn Y is n m suprtr of A, whr Y is form y onnting Y L n Y R to ommon root. 1 A root trpillr is root, unorr, n istintly lf-ll inry tr whr vry intrnl no hs t lst on hil tht is lf.
366 HOANG AND SUNG A (1) A (2) A L (1) A L (2) A R (2) A R (1) Figur 5: A iprtit (A L,A R ) of ut-suforst A. Th mpty tr is rprsnt y whit irl. Lmm 3.8. Lt A ut-suforst of T. If (A L,A R ) is iprtit of A thn msp(a) msp(a L )+msp(a R ). Proof. Consir n m suprtr Y L of A L suh tht L(Y L ) = msp(a L ). Dfin Y R for A R similrly. Lt Y tr form y onnting Y L n Y R with ommon root. Not tht Y is of siz msp(a L )+msp(a R ). By Lmm 3.7, Y is n m suprtr of A n hn th lmm follows. Lmm 3.9. Givn ut-suforst A of T, lt Y inry m suprtr of A with lft sutr Y L n right sutr Y R. Thr xists iprtit (A L,A R ) of A suh tht ithr (i) Y is n m suprtr of A L ; or (ii) Y L n Y R r m suprtrs of A L n A R rsptivly. Lmm 3.10. For h non-trminl ut-suforst A of T, thr xists iprtit (A L,A R ) of A suh tht msp(a) msp(a L )+msp(a R ). Proof. Lt Y inry m suprtr of A suh tht L(Y) = msp(a). By Lmm 3.9, thr xists iprtit (A L,A R ) of A suh tht ithr (1) Y is n m suprtr of A L ; or (2) Y L n Y R r m suprtrs of A L n A R rsptivly, whr Y L is th lft sutr n Y R is th right sutr of Y. In oth ss, L(Y) msp(a L )+msp(a R ). Thn th lmm follows. Th ov isussion thn ls to Thorm 3.11. Thorm 3.11. For vry ut-suforst A of T, th vlu msp(a) quls to { Λ(A), if A is trminl, mx{msp(a L )+msp(a R ) A L n A R iprtition A}, othrwis. W fin n orring of th ut-suforsts in O s follows. For ny ut-suforsts A 1,A 2 in O, w sy tht A 1 is smllr thn A 2 if A (i) 1 is ut-sutr of A (i) 2 for i = 1,2,...,k. Ourlgorithm numrts A O intopologilly inrsingorrnomputs msp(a) s on Thorm 3.11. Thorm 3.12 stts th omplxity of our lgorithm. Thorm 3.12. A mximum omptil suprtr of k root phylognti trs n otin in O ( 2 2kD n k) tim.
FIXED PARAMETER POLYNOMIAL TIME ALGORITHMS FOR MASP AND MCSP 367 Proof. Tsting if ut-suforst is trminl tks O(k) tims, n h trminl utsuforstathn rquirs O(k 2 ) tim for th omputtion of Λ(A). In viw of Lmm 3.3, it suffis to show tht h non-trminl ut-suforst A hs O(2 kd ) iprtits. This rsult follows from th ft tht for h i k, thr r t most 2 D wys to prtition th st of th sutrs tth to th root of A (i). In th spil s whr vry tr T (i) is inry, Thorm 3.13 shows tht our lgorithm tully hs ttr tim omplxity. Not tht th onpts of grmnt suprtr n omptil suprtr will oini for inry trs. Hn, our lgorithm improvs th O ( 8 k n k) -tim lgorithm in [6] for omputing mximum grmnt suprtr of k root inry trs. Thorm 3.13. If vry tr in T is inry, mximum omptil suprtr (or mximum grmnt suprtr) n omput in O ( 6 k n k) tim. Proof. W lim tht th prossing of non-trminl ut-suforsts of T rquirs O ( 6 k n k) tim. Th rgumnt in th proof of Thorm 3.12 tlls tht th rmining omputtion runs within th sm symptoti tim oun. Consir n intgr r {0,1,...,k}. W shll ling with ut-suforst A suh tht thr r xtly r ut-sutrs A (i) whos roots r intrnl nos of T (i) (. Th) ky of this proof is to show tht th numr of thos k ut-suforsts os not x (n 1) r r (n+1) k r, n th running tim for h utsuforst is O ( 4 r 2 k r). Hn, th totl running tim for ll non-trminl ut-suforsts is k ( k r r=0 ) ( (n 1) r (n+1) k r O 4 r 2 k r) ( = O 6 k n k). ( ) n ount th numr of th spifi ut-suforsts A s follows. First thr r k options for r inis i suh tht th roots of ut-sutrs A rw (i) r intrnl nos of T (i). For thos ut-sutrs, w thn ppoint on of th (n 1) or fwr intrnl nos of T (i) to th root no of A (i). Evry othr ut-sutr of A is lf or th mpty tr, n thn n trmin from t most n + 1 ltrntivs. Multiplying thos possiilitis givs us th oun stipult in th pring prgrph. It rmins to stimt th running tim for h spifi ut-suforst A. This tsk rquirs us to oun th numr of iprtits of h ut-suforst. If th root v of A (i) is n intrnl no of T (i) thn A (i) ontriuts 4 or fwr wys of prtitioning th st of th sutrs tth to v. Othrwis, w hv t most 2 wys of prtitioning this st. Hn A owns t most 4 r 2 k r iprtits, n this omplts th proof. 4. Algorithm for MCSP of unroot trs Lt T st of k unroot phylognti trs. This stion xtns th lgorithm in Stion 3 to fin th siz of mximum omptil suprtr of T. Th mximum omptil suprtr n otin y ktrking. Surprisingly, th xtn lgorithm for unroot trs runs within th sm symptoti tim oun s th originl lgorithm for root trs.
368 HOANG AND SUNG W will follow th sm pproh s Stion 3, i.., for h ut-suforst A of T, w fin n m suprtr of A of mximum siz. Dfinitions 3.1, 3.2, n 3.4 for utsuforst n m suprtr in th prvious stion r still vli for unroot trs. Noti tht lthough T is th st of unroot trs, h ut-suforst A of T onsists of root trs. (S Figur 6 for n xmpl of ut-suforst for unroot trs.) Hn w n us th lgorithm in Stion 3 to fin th mximum m suprtr of A. W thn slt th iggst tr T mong thos mximum m suprtrs for ll ut-suforsts of T, n unroot T to otin th mximum omptil suprtr of T. T (1) T (2) A (1) A (2) f f Figur 6: Th st of root trs A = {A (1),A (2) } is ut-suforst of T = {T (1),T (2) }. Thorm 4.1 shows tht th xtn lgorithm hs th sm symptoti tim oun s th lgorithm in Stion 3. Thorm 4.1. W n fin mximum omptil suprtr of k unroot phylognti trs in O ( 2 2kD n k) tim. Proof. Using similr proof s Lmm 3.3, w n prov tht thr r O ( 2 kd n k) utsuforsts of T. As givn in th proof of Thorm 3.12, fining th mximum m suprtrs of h ut-suforst tks O(2 kd ) tim. Hn th xtn lgorithm runs within th spifi tim oun. 5. Algorithm for MASP of root trs Lt T st of k root phylognti trs. This stion prsnts ynmi progrmming lgorithm to omput th siz of mximum grmnt suprtr of T in O ( (kd) kd+3 (2n) k) tim. Th mximum grmnt suprtr n otin in th sm symptoti tim oun y ktrking. Th i hr is similr to tht of Stion 3. Howvr, whil w n ssum tht omptil suprtrs r inry, th mximum gr of grmnt suprtrs n grow up to kd. It is th rson why w hv th ftor O((kD) kd+3 ) in th omplxity. Dfinition 5.1 (Su-forst). Givn st of k root trs T, su-forst of T is st A = {A (1),...,A (k) }, whr h A (i) is ithr n mpty tr or omplt sutr root t som no of T (i), n t lst on lmnt of A is not n mpty tr. Noti tht th finition of su-forst os not oini with th onpt of utsuforst in Dfinition 3.2 of Stion 3. For xmpl, th ut-suforst A in Figur 3 is not su-forst of T, us A (2) is not omplt sutr root t som no of T (2). Lt O not th st of ll possil su-forsts of T. Thn O = O ( (2n) k).
FIXED PARAMETER POLYNOMIAL TIME ALGORITHMS FOR MASP AND MCSP 369 Dfinition 5.2 (Enlos suprtr). For ny su-forst A of T, tr X is ll n nlos suprtr of A if X is n grmnt suprtr of A, n L(X) L(T (i) ) L(A (i) ) for ll i k. For h su-forstaof T, ltmsp(a) not th mximum siz of nlos suprtrs of A. W us similr pproh s Stion 3, i.., w omput msp(a) for ll A O, n msp(t ) is th siz of mximum grmnt suprtr of T. W prtition th su-forsts in O to two lsss. A su-forst A is trminl if h A (i) is ithr n mpty tr or lf. Othrwis, A is ll non-trminl. Noti tht for trminl su-forst, th finition of nlos suprtr oinis with th onpt of m suprtr in Dfinition 3.4 of Stion 3. Thn y Lmm 3.5, w hv msp(a) = Λ(A). (Pls rfr to th formul (3.1) in th prgrph pring Lmm 3.5 for th finition of funtion Λ.) Dfinition 5.3 (Domposition). Lt A su-forst of T. W sy tht su-forsts B 1,...,B (with 2) ompos A if for ll i k, ithr (i) Extly on of B (i) 1,...,B(i) is isomorphi to A (i) whil th othrs r mpty trs; or (ii) Thr r t lst 2 nonmpty trs in B (i) 1,...,B(i), n ll thos nonmpty trs r isomorphi to pirwis istint sutrs tth to th root of A (i). A (1) A (2) B 1 (1) B 2 (1) (2) (2) (1) B τ 1 τ 2 τ 3 τ 4 τ 1 B B 1 τ 2 3 2 τ 4 B 3 (2) Figur 7: A omposition (B 1,B 2,B 3 ) of su-forst A. Th mpty trs r rprsnt y whit irls. Figur 7 illustrts th onpt of omposition. For h su-forst A of T, w will prov tht msp(a) = mx{msp(b 1 )+...+msp(b ) B 1,...,B ompos A}. (5.1) Th intity (5.1) is thn stlish y Lmms 5.5 n 5.7. Lmm 5.4. Suppos (B 1,...,B ) is omposition of som su-forst A of T. Lt τ 1,...,τ som nlos suprtrs of B 1,...,B rsptivly, n lt X th tr otin y onnting τ 1,...,τ to ommon root. Thn, X is n nlos suprtr of A. Lmm 5.5. If (B 1,...,B ) is omposition of su-forst A of T thn msp(a) msp(b 1 )+...+msp(b ). Proof. For h B j, lt τ j n nlos suprtr of B j suh tht L(τ j ) = msp(b j ). Lt X th tr otin y onnting τ 1,...,τ to ommon root. By Lmm 5.4, X is n nlos suprtr of A. Hn L(τ 1 ) +...+ L(τ ) = L(X) msp(a).
370 HOANG AND SUNG Lmm 5.6. Lt X n nlos suprtr of som su-forst A of T, n lt τ 1,...,τ ll sutrs tth to th root of X. Thn ithr (i) Thr is omposition (B 1,B 2 ) of A suh tht X is n nlos suprtr of B 1 ; or (ii) Thr is omposition (B 1,...,B ) of A suh tht h τ j is n nlos suprtr of B j. Lmm 5.7. For h non-trminl su-forst A of T, thr is omposition (B 1,...,B ) of A suh tht msp(a) msp(b 1 )+...+msp(b ) Proof. LtX nnlos suprtrof Asuhtht L(X) = msp(a) nlt τ 1,...,τ llsutrstthtothrootofx. ByLmm5.6,ithr(i)Thrxistsomposition (B 1,B 2 ) of A suh tht X is n nlos suprtr of B 1 ; or (ii) Thr is omposition (B 1,...,B ) of A suh tht h τ j is n nlos suprtr of B j. In s (i), w hv L(X) msp(b 1 ) msp(b 1 ) + msp(b 2 ). On th othr hn, in s (ii), w hv L(X) = L(τ 1 ) +...+ L(τ ) msp(b 1 )+...+msp(b ). Th ov isussion thn ls to Thorm 5.8. Thorm 5.8. For vry su-forst A of T, th vlu msp(a) quls to { Λ(A), if A is trminl, mx{msp(b 1 )+...+msp(b ) B 1,...,B ompos A}, othrwis. W fin n orring of th su-forsts in O s follows. For ny su-forsts A 1,A 2 in O, w sy A 1 is smllr thn A 2 if A (i) 1 is ithr n mpty tr or sutr of A (i) 2 for i = 1,2,...,k. Our lgorithm numrts A O in topologilly inrsing orr n omputs msp(a) s on Thorm 5.8. In Lmm 5.9, w oun th numr of ompositions of h su-forst of T. Thorm 5.10 stts th omplxity of th lgorithm. Lmm 5.9. Eh su-forst of T hs O ( (kd) kd+1) ompositions, n gnrting thos ompositions tks O ( k 2 D 2) tim pr omposition. Proof. Lt A su-forst of T. Sin th mximum gr of ny grmnt suprtrof A is oun y kd, w onsir only ompositions tht onsist of t most kd lmnts. Wlimthtforh {2,...,kD}, thsu-forstaownso ( (+2) kd) ompositions (B 1,...,B ). Summing up thos symptoti trms givs us th spifi oun. Th ky of this proof is to prov tht for h s {1,...,k}, th tr A (s) ontriuts t most ( +1) D + < ( +2) D squns B (s) 1,...,B(s), n gnrting thos squns rquirs O() tim pr squn. W hv two ss, h orrspons to typ of th ov squn. Cs 1: On trm in th squn is A (s) ; thrfor th othr trms r mpty trs. Thn, w n gnrt this squn y ssigning A (s) to xtly on trm n stting th rst to mpty trs. This s provis xtly squns n numrts thm in O() tim pr squn. Cs 2: No trm in th ov squn is A (s). Consir n intgr r {0,1,...,} n ssum tht th squn onsists of xtly r trms tht r nonmpty nos. Thn thos r nonmpty trs r isomorphi to pirwis istint sutrs tth to th root of A (s). Lt δ th gr of th root of A (s). W gnrt th squn s follows. First w rw r pirwis istint sutrs tth to th root of A (s). Nxt, w slt r trms
FIXED PARAMETER POLYNOMIAL TIME ALGORITHMS FOR MASP AND MCSP 371 in th squn n istriut th ov sutrs to thm. Finlly w st th rmining trms to mpty trs. Hn this s givs t most ( ) δ! D r ( r)! < ( ) D r r = (+1) D r min{δ,} r=0 squns, n gnrts thm in O() tim pr squn. Thorm 5.10. A mximum grmnt suprtr of k root phylognti trs n otin in O ( (kd) kd+3 (2n) k) tim. Proof. Tsting if su-forst is trminl tks O(k) tims, n h trminl su-forst A thn rquirs O(k 2 ) tim for omputing Λ(A). By Lmm 5.9, h non-trminl su-forst rquirs O ( (kd) kd+3) running tim. Summing up thos symptoti trms for O ( (2n) k) su-forsts of T givs us th spifi tim oun. 6. Algorithm for MASP of unroot trs Lt T st of k unroot phylognti trs. This stion xtns th lgorithm in Stion 5 to fin th siz of mximum grmnt suprtr of T in O ( (kd) kd+3 (4n) k) tim. Th mximum grmnt suprtr n otin y ktrking. W sy tht st of k root trs F = {F (1),...,F (k) } is root vrint of T if w n otin h F (i) y rooting T (i) t som intrnl no. On niv pproh is to us th lgorithm in th prvious stion to solv MASP for h root vrint of T. Eh root vrint thn givs us solution, n th mximum of thos solutions is th siz of mximum grmnt suprtr of T. Bus thr r O ( n k) root vrints of T, this pproh s n O ( n k) ftor to th omplxity of th lgorithm for root trs. W now show how to improv th ov niv lgorithm. As mntion in th prvious stion, th omputtion of h root vrint of T onsists of O ( (2n) k) su-prolms whih orrspon to its su-forsts. (Pls rfr to Dfinition 5.1 for th onpt of suforst.) Sin iffrnt root vrints my hv som ommon su-forsts, th totl numr of su-prolmsw hv to runis muh smllr thn O(2 k n 2k ). Mor prisly, w will show tht th totl numr of su-prolms is only O ( (4n) k). A (root or unroot) tr is trivil if it is lf or n mpty tr. A mximl sutr of n unroot tr T is root tr otin y first rooting T t som intrnl no v n thn rmoving t most on nontrivil sutr tth to v. Lt O not th st of su-forsts of ll root vrints of T. Lmm 6.1. Lt A = {A (1),...,A (k) } st of root trs. Thn A O if n only if h A (i) is ithr trivil sutr or mximl sutr of T (i). Proof. Lt F root vrint of T suh tht A is su-forst of F. Fix n inx s {1,...,k} n lt v th root no of A (s). Our lim is strightforwr if ithr A (s) is trivil or v is th root no of F (s). Othrwis, lt u th prnt of v in F (s). Hn A (s) is th mximl sutr of T (s) otin y first rooting T (s) t v n thn rmoving th omplt sutr root t u. Convrsly, w onstrut root vrint F of T suh tht A is su-forst of F s follows. For h i k, if A (i) is trivil or A (i) is tr otin y rooting T (i) t som intrnl nothn onstruting F (i) is strightforwr. OthrwisA (i) is mximl sutr
372 HOANG AND SUNG of T (i) otin y first rooting T (i) t som intrnl no v n thn rmoving xtly on nontrivil sutr τ tth to v. Hn F (i) is th tr otin y rooting T (i) t u, whr u is th root of τ. Thorm 6.2. W n fin mximum grmnt suprtr of k unroot phylognti trs in O ( (kd) kd+3 (4n) k) tim. Proof. Th ky of this proof is to show tht h tr T (i) ontriuts t most (3n 1) mximl sutrs. It follows tht O (4n) k. Th spifi running tim of our lgorithm is thn strightforwr us h suprolm rquirs O ( (kd) kd+3) tim s givn in th proof of Thorm 5.10. Assum tht th tr T (i) hs xtly L lvs, with L n. W now ount th numr of mximl sutrs T of T (i) in two ss. Cs 1: T is otin y rooting T (i) t som intrnl no. Hn this s provis t most L 1 < n mximl sutrs. Cs 2: T is otin y firstrooting T (i) t som intrnl no v n thn rmoving nontrivil sutr τ tth to v. Noti tht thr is on-to-on orrsponn twn th tr T n th irt g (v,u) of T (i), whr u is th root no of τ. Thr r 2L 2 or fwr unirt gs in T (i) ut xtly L of thm r jnt to th lvs. Hn this s givs us t most 2(2L 2 L) < 2n 1 mximl sutrs. Rfrns [1] A. Amir n D. Kslmn. Mximum Agrmnt Sutr in st of Evolutionry Trs: Mtris n Effiint Algorithms. SIAM Journl on Computing, 26(6):1656 1669, 1997. [2] V. Brry n F. Niols. Mximum Agrmnt n Comptil Suprtrs. In Pro. 15 th Symposium on Comintoril Pttrn Mthing (CPM 2004), Lt. Nots in Comp. Sin 3109, pp. 205 219. Springr, 2004. [3] M. Frh, T. Przytyk, n M. Thorup. On th grmnt of mny trs. Informtion Prossing Lttrs, 55:297 301, 1995. [4] G. Gnpthysrvnvn n T. Wrnow. Fining mximum omptil tr for oun numroftrs with oungr is solvl inpolynomil tim. InPro. 1 st Workshop on Algorithms in Bioinformtis (WABI 2001), Lt. Nots in Comp. Sin 2149, pp. 156 163. Springr, 2001. [5] A. G. Goron. Consnsus suprtrs: th synthsis of root trs ontining ovrlpping sts of lll lvs. Journl of Clssifition, 3:335 348, 1986. [6] Sylvin Guillmot n Vinnt Brry. Fix-Prmtr Trtility of th Mximum Agrmnt Suprtr Prolm. InPro. 18 th Symposium on Comintoril Pttrn Mthing (CPM 2007), Lt. Nots in Comp. Sin 4580, pp. 274 285. Springr, 2007. [7] J. Hin, T. Jing, L. Wng, n K. Zhng. On th omplxity of ompring volutionry trs. Disrt Appli Mthmtis, 71:153 169, 1996. [8] Jspr Jnsson, Josph H.-K. Ng, Kunihiko Skn, n Wing-King Sung. Root Mximum Agrmnt Suprtrs. Algorithmi, 43:293 307, 2005. [9] M.-Y. Ko, T.-W. Lm, W.-K. Sung, n H.-F. Ting. An Evn Fstr n Mor Unifying Algorithm for Compring Trs vi Unln Biprtit Mthings. Journl of Algorithms, 40(2):212 233, 2001. [10] Mison, D.R., n K.-S. Shulz (s.). Th Tr of Lif W Projt. http://tolw.org, 1996-2006. This work is lins unr th Crtiv Commons Attriution-NoDrivs Lins. To viw opy of this lins, visit http://rtivommons.org/linss/y-n/3.0/.