/
EfcientAlgorithmsforSteinerEdgeConnectivityComputationandGomory-HuTre EfcientAlgorithmsforSteinerEdgeConnectivityComputationandGomory-HuTre

EfcientAlgorithmsforSteinerEdgeConnectivityComputationandGomory-HuTre - PDF document

megan
megan . @megan
Follow
343 views
Uploaded On 2020-11-24

EfcientAlgorithmsforSteinerEdgeConnectivityComputationandGomory-HuTre - PPT Presentation

ThispapercombinesresultsfromCH03HKP07andBHKP07ThisworkwassupportedinpartbyNSFgrantsCCF0515127andIDM0414763yUniversityofPennsylvaniaPhiladelphiaPAbhalgatcisupenneduWorkpartlydonewhenat ID: 824097

terminal proof lemma23 cut proof terminal cut lemma23 speci 1jh swap comp seefig time rst assuminginvariants1 biased 1vh bythede

Share:

Link:

Embed:

Download Presentation from below link

Download Pdf The PPT/PDF document "EfcientAlgorithmsforSteinerEdgeConnecti..." is the property of its rightful owner. Permission is granted to download and print the materials on this web site for personal, non-commercial use only, and to display it on your personal computer provided you do not modify the materials and that you retain all copyright notices contained in the materials. By downloading content from our website, you accept the terms of this agreement.


Presentation Transcript

EfcientAlgorithmsforSteinerEdgeConnecti
EfcientAlgorithmsforSteinerEdgeConnectivityComputationandGomory-HuTreeConstructionforUnweightedGraphsAnandBhalgatyRichardColezRameshHariharanxTelikepalliKavitha{DebmalyaPanigrahikAbstractWerstconsidertheSteineredgeconnectivityproblemonanunweightedundirectedorEuleriandirectedgraphwithnverticesandmedges.ThisprobleminvolvesndingtheedgeconnectivityofaspeciedsubsetSofvertices,i.e.thecardinalityoftheminimumcutinthegraphthatseparatestheverticesinSintotwoparts.Wegiveadeterministicalgorithmforthisproblemthatrunsin~O(m+nc2)time,wherecistheSteineredgeconnectivityofS.OuralgorithmextendsanalgorithmduetoGabow[Gab95]thatndstheminimumcutinagraphbyconstructinganedge-disjointspanningtreepacking.WeapplythisSteineredgeconnectivityalgorithmtosolveoursecondproblem,thatofconstructingGomory-Hutreesforundirectedunweightedgraphs.AGomory-Hutreeisasuccinctdatastructureforstoringpairwiseedgeconnectivityfor(orequivalently,maximumowbetween)allpairsofverticesinanundirectedgraph.AllpreviousalgorithmsforcomputingaGomory-Hutree[GH61,Gus90]usen1maximumowcomputations.ThefastestGomory-Hutreealgorithmonunweightedgraphswithmedgesandnverticeshasanexpectedrunningtimeof~O(mn+n2F),whereFisthemaximumpair-wiseconnectivitybetweenanypairofverticesinthegraph.Thisalgorithmusesan~O(m+nf)-timeLasVegasalgorithmforcomputingmaximumowduetoKargerandLevine[KL02],wherefisthemaximumow.WeimprovethetimecomplexityofconstructingaGomory-Hutreeto~O(mF),whichis~O(mn)forsimplegraphs.ThenoveltyofourapproachisinreplacingmaximumowcomputationsbySteineredgeconnectivitycomputationsandshowingthatwithhighprobabilitytheentiretimetakenfortheGomory-Hutreeconstructionbythismethodis~O(mF).Thispapercombinesresultsfrom[CH03],[HKP07]and[BHKP07].ThisworkwassupportedinpartbyNSFgrantsCCF0515127andIDM0414763.yUniversityofPennsylvania,Philadelphia,PA.bhalgat@cis.upenn.edu.WorkpartlydonewhenattheIndianInstituteofScience,Bangalore.zNewYorkUniversity,NewYork,NY.cole@cs.nyu.edu.xStrandLifeSciencesandHouseofAlgorithms,Bangalore.ramesh@strandls.com.WorkpartlydonewhenattheIndianInstituteofScience,BangaloreandwhilevisitingNewYorkUniversity,NewYork,NY.{IndianInstituteofScience,Bangalore.kavitha@csa.iisc.ernet.in.kMassachusettsInstituteofTechnology,Cambridge,MA.debmalya@mit.edu.WorkpartlydonewhenatBellLabsRe-search,BangaloreandtheIndianInstituteofScience,Bangalore.11IntroductionThispaperaddressestworelatedproblems,SteineredgeconnectivitycomputationandGomory-Hutreeconstruction,foranunweightedgraphG=(V;E)onnverticesandmedges.WeconsideronlyEuleria

ndirectedgraphsandundirectedgraphs.1.1St
ndirectedgraphsandundirectedgraphs.1.1SteinerEdgeConnectivityGivenanarbitrarysubsetSVofterminalvertices,weseektondthesmallestcutinthegraphsuchthatnotallterminalverticesappearonthesamesideofthecut.WecallsuchacutaSteinermin-cutanditsvaluedenestheSteinerEdgeConnectivityofS.Thisgeneralizesthetwomorewellstudiednotionsofaglobalmin-cut,whichrequiresonlyndingthesmallestcutsothatbothsidesarenon-empty,andans-tmin-cut,whichrequiresndingthesmallestcutsothatsandtareonoppositesides.TheSteineredgeconnectivityofarbitrarysetsofterminalverticeswaspreviouslystudiedbyDinitzandVainshtein[DV94],motivatedbythefactthatthesevariousnotionsofconnectivityabovecouldhavesubstantiallydifferentvalues,e.g.,inacompletegraphKnwitheachedgereplacedbyapath,theglobalmin-cutis2buttheSteineredgeconnectivityoftheoriginalverticesisstilln1.NotethatbyMenger'stheorem,thevalueoftheSteinermin-cutcequalsminu;v2Sc(u;v),wherec(u;v)isthenumberofedge-disjointpathsfromutov,(orfromvtou;bothareequivalentbyEulerianness).Infact,thiscanbesimpliedfurthertominv2Sc(r;v),whererisanyarbitraryvertexinS;wewillrefertorastheroot.Thisreadilysuggestamax-owapproachtotheproblem,i.e.,ndthemax-owfromrtoeveryothervertexinSandtakeminimumoftheseows.Thefastestmax-owalgorithmisduetoKargerandLevine[KL02]andrunsinexpected~O(m+nf)time,wherefisthemax-ow.ThisgivesaSteineredgeconnectivityalgorithmwithexpectedtimecomplexity~O((m+nF)jSj)forundirectedgraphsandEuleriandirectedgraphs,whereF=maxv2Sc(r;v).OurApproach.Wegiveafasteralgorithmforthisproblem—ouralgorithmisdeterministicandrunsin~O(nc2+m)timeforEuleriandirectedgraphsandundirectedgraphs,withinversepolynomialfailureprobability.Here,cdenotestheSteineredgeconnectivityofS.NoteinparticularthatouralgorithmisindependentofjSj.WewillfocusonEuleriandirectedgraphsinthedescriptionbelow.IndeedEuleriandirectedgraphsandundirectedgraphsareinterconvertibleasdescribedinTheorem6.Wedonotusethemax-owapproach.Insteadweusether-cutapproach,denedasfollows.OurtaskofndingtheSteinermin-cutboilsdowntondingaminimumcutsothatrisononesideandsomevertexfromSisontheotherside.Morespecically,weinsistthatrisonthesourceside,andthevalueofacutisthenumberofedgesgoingfromthesourcesidetothesinkside.Wecallsuchcutsr-cuts.WenowappealtosomeclassicaltheoremsbyEdmondslistedbelow[Edm69,Edm72].Tostatethesetheorems,weneedthefollowingdenitions.Anr-arborescenceisadirectedspanningtreerootedataspeciedrootvertexrwithalledgesdirectedawayfromr.Adirectionlessr-spanningtreeisalsoaspanningtreerootedatrlikeanarborescencebuthastheweakerco

nstraintthatonlyedgesincidentonrmustbedi
nstraintthatonlyedgesincidentonrmustbedirectedawayfromtheroot;allotheredgescanbearbitrarilydirected.Theorem1(Edmonds'Theorem[Edm69]).Themaximumnumberofedgedisjointr-arborescencesinadirectedgraphequalstheminimumcardinalityofanr-cut.Theorem2(Edmonds'RelaxedTheorem[Edm72]).Themaximumnumberofedgedisjointr-arborescencesinadirectedgraphequalsthemaximumnumberofedgedisjointdirectionlessr-spanningtreesinthesame2graphwiththepropertythateachvertexv=rhastotalin-degreecoveralltheser-spanningtrees,wherecisthetotalnumberoftreesconstructed.(Fromthedenitionofdirectionlessr-spanningtrees,rhasatotalin-degreeof0inthetrees.)Gabow[Gab95]usedtheabovetheoremstoobtainanalgorithmfordeterminingglobalconnectivityin~O(nc2+m)time,wherecistheglobalmin-cutvalue.Thisalgorithmattemptstobuildasmanyedge-disjointdirectionlessr-spanningtreesaspossible;whenitcanbuildnomore,thecountoftreesbuiltgivestheglobalmin-cutvalue.Equivalently,onecouldbuildr-arborescencesaswell;howeverthatturnsouttobemoreexpensive[BHKP08],andthereforedirectionlesstreesarepreferable.OuralgorithmusesthesameparadigmandstartswhereGabow'salgorithmends,i.e.,weshowhowwecancontinuethetreebuildingprocesstocontinuebuildingdirectionlesstrees(thoughofaslightlydifferentvariety,inparticularthesetreesarenotspanningtrees)beyondtheglobalmin-cutcount.NotehoweverthatwhileGabow'salgorithmaboveworksforarbitrarydirectedgraphsaswellin~O(mc)time,ouralgorithmworksonlyonEuleriandirectedgraphs.Weareaidedbythefollowingtheoremsinourquestforbuildingmoredirectionlesstrees.Letcon(v)=c(r;v)denotethemaximumnumberofedgedisjointpathsfromtherootvertexrtovertexv.Thefollowingtheoremappearsin[BJFJ95],althoughtheirsettingisslightlymoregeneral(namely,thegraphsneednotbeEulerian,butthenumberofedge-disjointpathsfromtheroottoeveryvertexwhosein-degreeissmallerthanitsout-degreeisatleastthenumberoftreesoneisseeking).Theproofisbasedonanedge-splittinglemmaduetoLov´aszanddoesnotimmediatelyleadtoanefcientalgorithm.Theorem3(TheTreePackingTheorem).GivenanEuleriandirectedgraphG,thereexistsacollectionofedge-disjointtreesrootedatrsuchthateachvertexv=rinGappearsinexactlycon(v)treesandalledgesinthetreesaredirectedawayfromtheroot.(ThesetreesneednolongercontainallverticesinG.)Theabovetheoremclearlyimpliesitsrelaxedversionstatedbelow.Theorem4(TheRelaxedTreePackingTheorem).GivenanEuleriandirectedgraphG,thereexistsacollectionofdirectionlessedge-disjointtreesrootedatr,suchthateachvertexv=rinGappearsexactlycon(v)timesoveralltrees(possiblyoccurringmultipletimesinatree)andhasin-degreeexactlyco

n(v)overthesetrees.Edgesinthesetreesarea
n(v)overthesetrees.Edgesinthesetreesareallowedtohavearbitrarydirections,exceptforthoseincidentonr,whichmustbedirectedawayfromr.Ourmaincontributionisafastconstructiveproofofacoarserversionoftheaboverelaxedtheorem.Inthiscoarserversion,wecontractctrees,wherecistheSteinermin-cutvalue.Avertexvwithcon(v)cappearsexactlyonceineachofthesetreesandwithtotalin-degreecon(v)overalltrees;wecallsuchverticeswhite.Incontrast,verticeswithcon(v)carepartitionedintovertexsetswhicharethencontractedintowhatarecalledblackvertices.EachblackvertexbrepresentsasetofverticesBintheoriginalgraph;suchavertexbappearscon(B)timesandwithtotalin-degreecon(B)overalltrees,wherecon(B)=maxv2Bcon(v).Notethatthepartitionintoblackverticesisdiscoveredontheyastreeconstructionprogresses.Wewilldiscovercutsofsizekwhiletryingtoconstructthek+1thtree,andeachsuchcut(i.e.,thesidenotcontainingr)willbeshrunkintoanewblackvertex.Wewillnowreducethenumberofoccurrencesofthisblackfromk+1tok.Atthispoint,webringinakeyideathatisneededfortreebuildingtoproceed;wewillrearrangethetreessoeachblackhasdegreeatmost2,intheprocessallowingforpossiblymultipleoccurrencesofablackinthesametree.Wecallthisdegreebalancing.ThewholetreeconstructionprocedureterminateswhenablackcontainingaterminalvertexfromSisdiscovered.Atthatpoint,wewillshowthatthesetofverticesrepresentedbythisblackisindeedaSteinermin-cut.31.2Gomory-HuTreeConstructionAGomory-Hutree(alsoknownasacuttree)isanO(n)-spacedatastructurewhichrepresentsthepairwiseedgeconnectivityofallpairsofverticesinanundirectedgraph.Moreprecisely,itisaweightedtreeTonV,withthepropertythatthepairwiseedgeconnectivitybetweenanytwoverticessandtinthegraphequalstheminimumweightofanedgeontheuniques-tpathinT.Further,thepartitionoftheverticesproducedbyremovingthisedgefromTisaminimums-tcutinthegraph,i.e.acutofcardinalityequaltothes-tedgeconnectivity.AnundirectedgraphhasatleastoneGomory-Hutree,butitmightnotbeunique;ontheotherhand,examplesbyBencz´ur[Ben95]showthatGomory-Hutreesneednotexistfordirectedgraphs.Gomory-Hutreeshavemanyapplicationsinmulti-terminalnetworkows.AllthepreviousalgorithmsforconstructingGomory-Hutreesinundirectedgraphsusemax-owsub-routine.GomoryandHu[GH61]gavetherstalgorithmforconstructingGomory-Hutreesusingn1max-owcomputationsandgraphcontractions.Guseld[Gus90]proposedanalgorithmthatdoesnotusegraphcontractions;alln1maxowcomputationsareperformedontheinputgraph.GoldbergandTsiout-siouliklis[GT01]didanexperimentalstudyofthesetwoalgorithmsanddescribedefcientimplementationsforthem.ThefastestGom

ory-Hutreealgorithmonsimpleunweightedgra
ory-Hutreealgorithmonsimpleunweightedgraphswithmedgesandnverticeshasanexpectedrunningtimeof~O(mn+n2F),whereFisthemaximumpairwiseedgeconnectivityofapairofverticesinthegraph,usingthe~O(m+nF)LasVegasalgorithmformax-owduetoKargerandLevine[KL02].OurContribution.Inthispaper,wedesignanalgorithmforconstructingaGomory-Hutreewithoutusingn1max-owsubroutines,butusingourSteinerconnectivityalgorithminstead.Ouralgorithmhasatimecomplexityof~O(mF);thisimprovesuponthepreviousbesttimecomplexityof~O(mn+n2F).Theorem5.LetG=(V;E)beanunweightedundirectedgraphwithmedgesandnvertices.AGomory-HutreeforGcanbeconstructedin~O(mF)time,whereF=maxu;v2Vc(u;v);therunningtimeholdswithinversepolynomialfailureprobability.ToillustratewhatroleSteinerconnectivitycomputationplaysinconstructingtheGomory-Hutree,con-siderthefollowing.Supposewendaglobalminimumcut(C;VC).Inthisprocesswealsondthepairwiseminimumcutforallpairsofverticeswhichareseparatedbythiscut.ForGomory-Hutreecon-struction,itremainstondtheminimumcutbetweenpairsofverticeswhichareeitherbothinCorbothinVC.Todothis,wedenetwosubproblems.Intherst,wedesignateallverticesinCasterminals,shrinkallverticesinVCdowntoasinglevertexandthensolveaninstanceoftheSteinerconnectivityproblem.ThisgivesapartitionC1;C2;VCofVandminimumcutshavebeenfoundforallvertexpairsseparatedbythispartition.ThesecondsubproblemisanalogousbuthasverticesinVCasterminals.Recursiveprocessingyieldsminimumcutsforallpairsofvertices.NotethateachrecursivesubproblemisaninstanceoftheSteinerconnectivityproblem.1.3OtherApplicationsItfollowsfrom[CH03]thatourSteinerconnectivityalgorithmalsoyieldsafastimplementationoftheWilliamson,Goemans,MihailandVaziranialgorithm[WGMV95]fortheUniformSurvivableNetworkDesignProblem.ThisimplementationrunsintimeO((maxvfrvg3nlogn+maxvfrvg2nlog2n).Here,eachvertexvofthegivenundirectedgraphhasanassociatednon-negativeintegrallabelrv,whichisusuallyasmallconstantinpractice,andtheaimistochooseacollectionofedgesofminimumcostsothateachpairofverticesv;whasminfrv;rwgedgedisjointpaths.4Wealsohaveanalgorithmwithexpectedrunningtime~O(m+nk2)forconstructingapartialGomory-Hutreewithparameterk,1and,by[HKP07],analgorithmwithexpectedrunningtime~O(m+nk2)thatsplitsagivensubsetTVofevencardinalityintotwooddcardinalitycomponents,wherekisthecardinalityofthecut.1.4RoadmapSection2describespreliminaryresultsneededforouralgorithm.InSection3,weverybrieyreviewGabow'sglobalconnectivityalgorithm.InSection4,wegiveanoutlineofourSteinerconnectivityalgo-rithm.Thisalgorithmhasmanydifferentstepsan

dprocedures.Section5providesinvariantsan
dprocedures.Section5providesinvariantsanddenitionsofsomekeyobjectsinthealgorithm,denesinput-outputcharacteristicsofeachprocedure,andshowsthattheseproceduredoindeedmaintaintheinvariants.DetailedproceduredescriptionsappearinSections6,7and8.TheGomory-HutreealgorithmispresentedinSection9.Finally,weconcludeandoutlinesomepossibledirectionsoffutureworkinSection10.2PreliminariesThefollowingtheoremshowsthatEuleriandirectedgraphsandundirectedgraphsareequivalentfromtheperspectiveofcutsizes.Theorem6.AnEuleriandirectedgraphGcanbeconvertedtoanundirectedgraphG0suchthateachcutinG0isexactlytwicethecorrespondingcutinG.Similarly,aundirectedgraphGcanbeconvertedtoanEulerianundirectedgraphG0suchthateachcutinG0isexactlythesameasthecorrespondingcutinG.Proof.IgnoringdirectionsinanEuleriandirectedgraphyieldsanundirectedgraphwhereeachcutisexactly2timesthevalueofthecorrespondingcutintheoriginaldirectedgraph.Andconvertingeachedgeinanundirectedgraphintotwoedges,oneineachdirection,yieldsanEuleriandirectedgraphwhereeachcuthasexactlythesamesizeasthecorrespondingcutintheoriginalgraph.Unlessexplicitlystatedotherwise,weassumeEuleriandirectedgraphsinthedescriptionbelow.Thefollowingtheoremshelpjustifycompressionofsmallcuts,i.e.,theyhelpshowthatbiggercutscanbefoundcorrectlyevenaftercompressingsmallerones.Fact1(Submodularityofcuts).IfAandBaretwosubsetsofverticesinGand(X)representsthesizeofthecut(X;VnX),then(A)+(B)(A\B)+(A[B).Theorem7.If(S;VnS)isaminimums-tcutinGandforsomepairofverticesu,v,u;v2S,thenthereexistsaminimumu-vcut(S;VnS)suchthatSS.Thefollowingtheoremhelpsprunethenumberofedgesinthegraph.Theorem8.GivenanundirectedgraphGwithnverticesandmedges,anorderedcollectionofforestssatisfyingthefollowingconditioncanbeconstructedinO(n+m)time:Everyedgeispresentinsomeforest.1ApartialGomory-HutreewithparameterkisacontractedGomory-Hutreewherealledgeswithweightmorethankarecontracted.5Ifapairofverticesisnotconnectedinaparticularforest,thenthepairisnotconnectedinanysubsequentforest.Consequently,atleastiedgesfromeachcutofcardinalityiarepresentamongtherstiforests.Theorem8canbeusedtoimprovetherunningtimeofouralgorithmasfollows.Ouralgorithmbuildsdirectionlesstreessequentiallybuildingonedirectionlesstreeatatime.Tobuildthekthtree,wecanrestrictthesetofedgestothoseintherstkNagamochi-Ibarakiforests.ByTheorem8,therstkforestshaveO(nk)edgesandallcutsofsizekorsmallerarepreserved.Alsonotethatwhiletheabovetheoremisstatedforundirectedgraphs,ananalogousfactholdsforEuleriandirectedgraphsbyTheorem6.3Gabow'sAlgor

ithmforGlobalConnectivityRecallfromSecti
ithmforGlobalConnectivityRecallfromSection1thatGabow'salgorithm[Gab95]isbasedonTheorem2whichinvolvesconstructingasequenceofedge-disjointdirectionlessr-spanningtrees.Thesedirectionlessspanningtreesareconstructedoneatatime.GiventherstkspanningtreesT1;:::;Tk,thek+1thtreeTk+1isconstructedinseveralrounds.Tk+1isbuiltfromaforestinitiallycomprisingnsingletonvertices.Overloadingournotation,wenamethisforestTk+1.Eachdistincttreeinthisforestiscalledacomponent.EachroundintheconstructionprocessrunsinO(n+m)timeandreducesthenumberofconnectedcomponentsinthek+1thforestTk+1byatleasthalf,leadingtoanoveralltimeofO((n+m)logn)pertree.ByTheorem8,thetimetobuildTk+1isO(nklogn+m).Gabow'salgorithmneedstobuildc+1trees,wherecistheglobalmin-cut(thealgorithmabortsbeforebuildingthelasttree);thetotaltimetakenisthusO(nc2logn+m).Anyparticularroundbeginswithseveralconnectedcomponents,eachofwhichhasexactlyonede-cientvertex,i.e.,avertexwhosetotalin-degreeinT1:::Tk+1isk(allotherverticeshavein-degreek+1inT1:::Tk+1).Eachoftheseconnectedcomponentsgetsprocessedinthisround.ConsideronesuchcomponentCompwithadecientvertexv.ClosureComputation.Gabow'salgorithmnowcomputestheminimumsetMcontainingedgessatisfyingatleastoneofthefollowingproperties:Seed:eisunused,i.e.,e62T1:::Tk+1,andisdirectedintov.Swap:eisinoneofT1:::Tk+1andisinthefundamentalcycleformedbysomeedgefinMwithrespecttothattree.Incidence:e62T1:::Tk+1andisdirectedintoavertexintowhichsomeotheredgeinMisdirected.Clearly,computingMneedsaclosurecomputationalgorithm,andGabowshowshowtoperformthisef-ciently,i.e.,intimeproportionaltothenumberofedgesandverticesinvolvedinM.TransformationSequence.Notethatimplicitintheclosurerulesitemizedaboveistheintenttoidentifyatransformationsequence,i.e.,asequenceofrearrangementstothetreeswhereedgesaremovedacrosstreesandanedgeconnectingcomponentsisfreedforaddingtoTk+1.AtransformationsequenceforCompmaintainsonefreeedgewithitatanypointoftime;itthenusesthisfreeedgetoobtainanotherviaspecicoperations.Anunusededgedirectedintothedecientvertexvservesastheinitialseedfreeedge.Aswapaddsafreeedgetoatreeandfreesatreeedgefromtheresultingfundamentalcycle.Anincidencetakesafreeedge(eithertheseededgeoroneobtainedafteraswap)andreplacesthatedgewithanotheredgeedirectedintothesamevertex;enowbecomesafreeedge,availableforfutureswaps.Itwillbethecasethat6ewillbederivedfromthepoolofwhatarecalledunusededges,i.e.,thosewhichwereoutsideT1;:::;Tk+1tobeginwith.Notethattheabovetransformationspreservein-degreesofverticesinthetreesplusfreeedgecombined.These

operationsgoonuntilthefreeedgeathandconn
operationsgoonuntilthefreeedgeathandconnectsComptoanothercomponentinTk+1.ClosureOutcomes.Gabowshowsthattheclosurealgorithmabovehasoneoftwopossibleoutcomes.EitherthereexistsatransformationsequencewhichconnectsComptoanothercomponentinTk+1.OrthesetCofverticesintowhichedgesofMaredirectedoccurcontiguouslyinT1:::Tk+1,andfurther,C;VCactuallyformsanr-cutofsizek.Intheformercase,thealgorithmhasmadeprogresstowardsreducingthenumberofconnectedcomponents,andinthelattercase,thealgorithmterminatesandclaimsthatCistheglobalmin-cut,ofsizek.TheGlobalMin-Cut.OfcriticalimportanceistheproofthatCformsanr-cutofsizek.Thisproofisbasedonthefollowingfacts.EachvertexinCotherthanvhasin-degreek+1inT1:::Tk+1andvertexvhasin-degreekinT1:::Tk+1.VerticesinCoccurcontiguouslyineachofT1:::Tk+1.EdgesnotinT1:::Tk+1butdirectedintoavertexinCliecompletelywithinC.Thus,edgesdirectedintoCfromVCmustallbeinT1:::Tk+1.Aneasyconsequenceofthersttwopropertiesisthatthein-degreeofCinT1:::Tk+1isatmostk.Thethirdpropertyensuresthatthein-degreeofCinthewholegraphisalsoatmostk.Andananalogouscountingargumentshowsthattherearenocutsofsizek1,soCisindeedamin-cut.4OutlineoftheSteinerConnectivityAlgorithmInthissection,wegiveanoutlineofourSteinerconnectivityalgorithm.Asdiscussedearlier,thisalgorithmgeneralizesGabow'sglobalconnectivityalgorithmwhichwasdescribedintheprevioussection.Throughoutthissectionandthesubsequentdetaileddescriptionofthealgorithm,G=(V;E)isanEuleriandirectedgraphwithnverticesandmedges.LetSdenotethesetofterminalverticeswhoseSteinerconnectivityweareinterestedinnding.WestartwithGabow'salgorithm.Say,thealgorithmbuildsktreeswithrootvertexr2SandisnowworkingonTk+1.ByTheorem8,weassumethatm=O(nk)whilebuildingTk+1.Asbefore,werunseveralrounds,attheendofwhichTk+1isconstructed.Consideraparticularround.Asearlier,foreachcomponentCompinTk+1,thegoalofthisroundistomodifythetreesinsuchawaythatCompgetsconnectedtosomeothercomponent.Tothiseffect,werunGabow'sclosurecomputationalgorithmonCompwithallunusededgesdirectedintotheuniquedecientvertexinCompasseededges.SupposethisclosurecomputationgetsstuckinaclosuresetC.Thisimpliesacut(VC;C)ofsizekandGabow'salgorithmquitsatthispointreturningthiscutastheglobalmin-cut.Incontrast,ouralgorithmwillneedtocontinuefurtherifSVC(becausethecutfoundabovedoesnotsplitS).ItfollowsfromTheorem7thatthereexistsaminimumSteinercut(X;VX)suchthattheentiresetCispresentononesideofthecut,i.e.,CXorCVX.ThusforthepurposeofndingaminimumSteinercut,wecanhenceforthregardtheentiresetCasasinglevertex.7BlackVe

rticesandWhiteVertices.Wecontractallvert
rticesandWhiteVertices.WecontractallverticesinCintoasinglevertexc(wewillcallsuchcontractedverticesblackverticestodistinguishthemfromotheroriginaluncontractedverticeswhichwecallwhitevertices);allfurthercomputationhappensonthisnewgraphwithfewervertices.ThetreesT1;:::;Tk+1willneedtobemodiedtoreectthiscontraction:thisturnsouttobestraightforwardbecauseofthecontiguityproperty,i.e.,allverticesinCoccurcontiguouslyineachtree.Oncethetreeshavebeenmodiedtoreectthiscontraction,werunintoournextchallenge,namely,howtocontinuethealgorithm?Morespecically,theissueisthatthevertexchasjustkedgesdirectedintoitandthereforecanneverachievein-degreek+1inthetrees.SowecannotcompletebuildingtreeTk+1whilesatisfyingtheinvariantthateachvertexhasin-degreek+1,asrequiredinGabow'salgorithm.Thusthein-degreeinvarianthastoberelaxedforc.Socisnotgoingtobearegularvertexlikeothervertices;howeverouralgorithmcannotignorecandtheedgesincidentonc,sincetheseedgescouldcontributetotheconnectivitybetweenpairsofverticesinVC.WeneedanewoperationonalloccurrencesofcinT1;:::;Tk+1tobeabletoretaincinaspecialwaysothatwecancontinuetorunthetreeconstructionalgo-rithm.Ourcrucialideahereisanoperationcalleddegree-balancingthatwewillperformonalloccurrencesofc.Wedescribethisbelow.rv1v2v3v4v5v6v7v8v9v10b1b2b3b3b2b3b2Figure1:Adegree-balancedtree.DegreeBalancing.Notethatchask+1occurrencesandin-degreekoveralltrees.Alsonotethatthisleavesnounusededgedirectedintoc,i.e.,alledgesdirectedintocareusedinT1;:::;Tk+1.WerearrangeedgeswithinthetreesT1;:::;Tk+1sothatalloccurrencesofvertexchavedegreeatmost2(seeFig.1,whereb1,b2andb3areblackvertices);theprocedurewhichachievesthisiscalledthedegreebalancingprocedure(thisprocedureusestheEuleriannatureofthegraph).Thisprocedurecouldcreatemultipleoccurrencesofablackvertexwithinthesametree,butthetotalnumberofoccurrencesandtotalin-degreeswillstillbepreserved.Notethatthisissimplyarearrangementofedges;thegraphitselfdoesn'tchange.Wealwaysmaintainthatonlywhiteverticescanhavedegree3ormoreinthetrees.Theneedforthisdegreeatmost2criterionforblackverticeswillbecomeapparentinourmodiedclosurecomputationprocedurebelow.Butnotethatthisideaisakintosplitting-offc(pairinganincomingedgeincidentoncwithanoutgoingedgetocreateanewsuperedgesocvirtuallydisappearsfromallfuturecomputations),butwithanotabledifferencethatweallowincomingedgestopairwitheachotherandlikewiseforoutgoingedges.Thisoperationcanbeconsideredasdirectionlesssplitting-offofthevertexc,inthesamespiritvis-a-vissplitting-offasEdmonds'RelaxedTheorem(Theorem2)isin

relationtoEdmonds'Theorem(Theorem1).8Su
relationtoEdmonds'Theorem(Theorem1).8Superedges.Afterdegree-balancing,edgesinthetreescanbeorganizedintosuperedges,i.e.,pathsstartingandendingatwhiteverticesandcarryingonlyblackverticesinternally.Forinstance,inFig.1,rb1v1isasuperedge,asarerv2,rv3,andv1b2b3v4.Pathsthatleadfromaleafblacktotheirnearestwhiteancestorsarecalledpartialsuperedges,e.g.,b2v6,b3v1.WeusethetermsuperedgetoemphasizethattheseplayessentiallythesameroleinouralgorithmthatedgesdoinGabow'sglobalconnectivityalgorithm.rruub1b1b1b2b2vvFigure2:Aseedsuperedge.SeedSuperedges.OurnextchallengeistocontinuethetaskofconnectingComptoanothercomponentinTk+1.ThesoledecientvertexinCompisnowpartofcandchasnounusededgesdirectedintoittoserveasseededgestostartanotherclosurecomputation.Weshowthatoneofthefollowingtwocasesoccursnow:Either,Compcomprisesonlytheblackvertexc,inwhichcasewejustdiscardComp.Thisleaveskoccurrencesofcinthetreeswitheachoccurrencehavingdegree2orless,andtotalin-degreeoveralloccurrencesequaltok,andweneedtodonothingmoreforComp.Or,Compcomprisesverticesotherthanc.Sincecoccursk+1timesinthetreeswitheachoccurrencehavingdegreeatleast1andatmost2,andsincechasdegree2kinthecurrentgraph,thereexist2leafoccurrencesofcinthetrees.Eachleafoccurrencehasanassociatedpartialsuperedgeleadingtoitsnearestwhiteancestor;weremovethesetwopartialsuperedgesfromtheirrespectivetreesandcombinethemtogetherasshowninFig.2toyieldanewsuperedge.Wecallthissuperedgeaseedsuperedge;aswewillseeshortly,itplaystheroleofaseededgeinthenextclosurecomputationprocess.Thisleaveskoccurrencesofcinthetreesandtheseedsuperedgetakentogether,witheachoccurrencehavingdegree2orless,andtotalin-degreeoveralloccurrencesequaltok.Intheformercase,wearedonewithCompasitnolongerexists.Inthelattercase,ifoneorbothwhiteendpointsoftheseedsuperedgeareoutsideCompthenCompcanbeconnectedtoothercomponent(s)inTk+1byre-pairingedgesincidentontheblackvertexinquestion(seeSection6.3forthesedetails).TheproblemcaseiswhenboththewhiteendpointsoftheseedsuperedgebelongtoComp.Inthiscase,weusethisseedsuperedgetostartthenextclosurecomputationprocedureinComp,asdescribedbelow.ExtendedClosureComputation.Summarizing,ourextendedclosurecomputationprocedurehastodealwiththefollowingtwocasesonComp.TherstcaseiswhenCompcontainsadecientwhitevertex9w(sowhasin-degreekinthetrees).Inthiscase,unusededgesdirectedintowserveastheseededgesforclosurecomputation.ThesecondcaseiswhenthereisnodecientvertexinCompbutthereisaseedsuperedgewithbothwhiteendpointsinComp;thispathstartsthenextclosurecomputation.Fig.3captur

esthissituation,illustratingthatduringar
esthissituation,illustratingthatduringaroundeachcomponentofthecurrenttreeTk+1(excepttheonethatcontainstherootr)iseitherindecientvertexcaseortheseedsuperedgecase.rrrT1TkthecurrentforestTk+1seedsuperedgecasedecientvertexcaseFigure3:Duringaround,everycomponentofTk+1,excepttheonecontainingr,isinoneofthese2cases:seedsuperedgecase/decientvertexcase.Gabow'sclosurecomputationprocedurerunsintothefollowingprobleminthisnewsettingwithblackverticesandwhitevertices.Ablackvertexhaskorfeweroccurrencesandhencedoesnotappearineverytree.ThiscausesafundamentalprobleminGabow'sroundrobinscheme.Wesolvethisproblembyusingsuperedgesinsteadofedgesformostpart;sincesuperedgeshavewhiteendpointsandsincewhiteverticesarepresentineverytree,wenolongerrunintotheproblemmentionedabove.However,workingwithwhiteendpointsofsuperedgesaloneandignoringtheinterveningblackverticesleadstoanotherproblem.WhenGabow'sclosurecomputationprocedureendsbygettingstuckinaclosuresetB,wecannolongerclaimthatBconstitutesak-cutintheoriginalgraph.Thereasonwhywecannotmakethisclaimisbecauseoflackofcontiguity:whiteverticesinBarecontiguousinthetreesbutoncetheinterveningblackverticesarebroughtintoplayaswell,thiscontiguitybreaksdown.ToactuallyclaimthattheclosuresetBisakcut,Bwillhavetobeclosedovertheblackverticesaswell,i.e.Bmustbeasetofwhiteverticesandblackverticessuchthatineachtree,theoccurrencesofthewhiteverticesinBandthe(possiblymultipleorzero)occurrencesoftheblackverticesinBmustbecontiguous.Thispropertycannotbeensuredbytheswapandincidencerulesalone.Wewillneedanadditionalrulecalledthematerulewhichessentiallyperformsre-pairingonedgesincidentonblackvertices.Whiletheswapandincidencerulesworkonsuperedgesandignoreblackvertices,themateruleconsidersblackverticeswiththeintentionofrevisingthepairingofedgesthatweperformedduringdegreebalancing.ThisrevisionresultsinthecreationofnewsuperedgesfromexistingonesasshowninFig.4.Withthis,wewillbeabletoshowthatanyresultingclosuresetBisindeedak-cutinthegraphandthereforeverticesinBcanbecontractedtoanewblackvertexforallfuturecomputation.Ontheotherhand,iftheaboveextendedclosurecomputationprocedureidentiesaconnectingsuperedge,wewillshowthatthereexistsasequenceofswap,incidenceandmateoperationswhichwillreleaseaconnectingsuperedgeenablingitsadditiontoTk+1,andconsequentreductioninthenumberofcomponentsinTk+1.TheWholeAlgorithm.Nowwearereadytobringtogethertheaboveelementsintoacompletealgorithm10bacabcddFigure4:AMateOperation;2superedgeswithacommonblackmatetoyieldtwonewsuperedges(seeAlgorithm1).Westartwith

treesT1;:::;Tk+1withTk+1havingconnectedc
treesT1;:::;Tk+1withTk+1havingconnectedcomponentseachofwhichhasadecientvertex(exceptthecomponentcontainingtherootr).Wenowrunseveralrounds,whereeachroundreducesthenumberofconnectedcomponentsinTk+1byaconstantfraction.ThealgorithmforaroundperformsextendedclosurecomputationsanddegreebalancingstepsonthevariouscomponentsinTk+1.Aparticularcomponentmayhavetogothroughseveraliterationsofclosurecomputationsanddegree-balancings;eachsuchiterationwillidentifyanewk-cutandcreateanewblackvertex,degree-balancethatvertex,andidentifyanewseedsuperedgeforthewholecomponent.Whenthissequenceofiterationsterminatesforallcomponents,wewillbeleftwiththetaskofperformingasequenceofswap,incidenceandmatetransformationstoactuallyreleaseappropriatesuperedgesandaddthemtoTk+1sothenumberofcomponentsinTk+1reducesbyaconstantfraction.Andifanyofthek-cutsfoundabovesplitsverticesinSthenwearedone.Notethattheaboveprocedurewillbeperformedonallcomponentsconcurrentlyandthereforeweneedtoensurethatthecomponentsdonotinterferewitheachother.Thiswillrequirethatthedegree-balancingstepsandthestepsforexecutingthetransformationsequencebesplitintotwoparts.Therstpartwillworkpurelywithinthecomponentandcanthereforebeperformedindependentlyforeachcomponent.Thesecondpartwillinvolveinterferenceacrosscomponentsandwillbeperformedbyaglobalprocedurewhichtakesallcomponentsintoaccount.Fordegree-balancing,wecallthesetwopartslocalandglobalrespectively.Algorithm1Overallsequenceofstepsinaround.foreachcomponentCompsequentiallyinarbitraryorderdo1.InitializeSeed(Comp)totheseedsuperedgeforComp,ifoneexists,andotherwisetothesetofunusededgesdirectedintothedecientvertexwinComp.repeat2.RunextendedclosurecomputationonCompwithSeed(Comp)toobtainanewclosuresetB.OutputBifBintersectswithS,thesetofterminalverticeswhoseSteinerconnectivityisinquestion.3.CompressBintoanewblackvertexandperformlocaldegree-balancingonBresultinginanewseedsuperedgeSeed(Comp).untileitherclosurecomputationabortsbeforeanewclosuresetisfoundorlocaldegreebalancingabortsbecausedegreebalancingrequiresgoingoutsideCompendfor4.PerformglobaldegreebalancingforallcomponentsCompforwhichlocaldegreebalancingabortedabove,resultinginanewseedsuperedgeSeed(Comp)foreachsuchcomponentComp.5.ForeachcomponentComp,runextendedclosurecomputationwithSeed(Comp).6.UsetherunningtraceofStep5toidentifytransformationsequencesforeachcomponentComp,andexecutethesetransformationsequencesforaconstantfractionofthecomponentstoreducethenumberofcomponentsinTk+1byaconstantfactor.115AlgorithmDetailsWenowdescribedetail

s,listoutinvariantsandprovideproofsofcor
s,listoutinvariantsandprovideproofsofcorrectnessandcomplexity.Section5.1listsouttheinvariants.Section5.2denesclosuresetsformallyandshowsthatthecutoutputbyAlgorithm1isindeedaSteinermin-cut,providedtheinvariantshold.Section5.3denestransformationsthatwewillperforminStep6ofAlgorithm1andshowsthatthesetransformationsmaintaintheinvariants.Section5.4thendescribesinput-outputcharacteristicsofourkeyprocedures,extendedclosurecomputation,degreebalancing,andtransformationsequenceidentication,andshowsthateachofthesemaintainstheinvariantsaswell.Section6describesdetailsofdegreebalancing,Section7describesdetailsofextendedclosurecomputation,andSection8describesdetailsofobtainingtransformationsequences.5.1InvariantsandSomeUsefulPropertiesWerstdeneourkeyinvariants.(1)EachconnectedcomponentCompofTk+1(otherthantheonecontainingtherootvertexr)containsatmostonedecientwhitevertexwhosetotalin-degreeisk.Ifnosuchvertexexists,thenComphasanassociatedseedsuperedgewithbothwhiteendpointsinsideComp.(2)AwhitevertexoccursexactlyonceineachofthetreesT1;:::;Tk+1.(3)Awhitevertex(otherthanr)hastotalin-degreeeitherkork+1inthetreesandseedsuperedgetakentogether.(4)Eachblacksupervertexbhasbothtotalnumberofoccurrencesandin-degreeequaltoC(b)(theedgeconnectivityofbinG)inthetreesandtheseedsuperedgestakentogether,whereC(b)k.Notethatablacksupervertexcouldhavemorethanoneoccurrencepertreeanddoesnotcontaintherootr.(5)EachoccurrenceofablackvertexinT1;:::;Tk+1hasdegreeatmost2,andalldegree1blackoccur-rencesareinT1.SuperedgesandPartialSuperedges.RecallfromSection4thatedgesinT1;:::;Tk+1areorganizedintosuperedges(whitetowhitewithonlyblacksinternally)andpartialsuperedges(whitetoleafblack).UnusedEdges.TheseareedgesinthegraphthatareoutsideofT1;:::;Tk+1aswellastheseedsuperedges.Notethatallsubsequentreferencestothetermunusededgerefertoedgeswhichareoriginallyunused,i.e.,outsideofT1;:::;Tk+1tobeginwith.Asweperformtreetransformations,unusededgescouldenterthenewtransformedtrees;neverthelesswewillstillrefertotheseedgesasunusededges.Asweshowbelow,anunusedendmustbedirectedintoawhitevertex;inaddition,eachunusededgewithblackendpointbhasanassociatedleafoccurrenceofbinT1;:::;Tk+1.Clearly,wecanmovethepartialsuperedgeassociatedwithbacrosstreeswithoutviolatingInvariants1-4andtherstpartofInvariant5;hencethesecondpartofInvariant5,i.e.,withoutlossofgenerality,weassumethatonlytreeT1hasblackleavesinit.Lemma1.AssumingInvariants1-5,everyunusededgeisdirectedintoawhitevertex.Proof.Weneedtoshowthateveryedgedirectedintoablackvertexbispresentin

thetrees.Invariant4saysthateveryblackver
thetrees.Invariant4saysthateveryblackvertexbhasin-degreeinthetreesequaltoitsedgeconnectivity,sayi(thatis,thecut(VB;B)wasdiscoveredwhilebuildingTi+1andthesetBgotcontractedtotheblackvertexb).SothereareexactlyiedgesfromverticesofVBdirectedintob.AsperInvariant4,alltheseiedgesintobarepresentinthetrees.Thusthereisnounusededgedirectedintob.Asthisistrueforanyblackvertexb,itfollowsthateveryunusededgeisdirectedintoawhitevertex.12Lemma2.AssumingInvariants1-5,thenumberofleafoccurrencesofanyblackbinT1;:::;Tk+1equalsthenumberofunusededgeswithendpointb;sothereexistsaone-to-onemappingfromthesetofleafoccurrencesofbtothesetofunusededgesincidentonb.Proof.Letibetheedgeconnectivityofablackvertexb.ThenLemma1tellsusthatthein-degreeofbinthegraphisequaltoitsin-degreeinthetrees,whichisi(byInvariant4).SincethegraphisEulerian,thetotaldegreeofbis2i,sinceitsin-degree=out-degree=i.Also,thenumberofoccurrencesofbinthetreesisi(byInvariant4)andeachoccurrenceiseitheraleafoccurrenceoradegree2occurrence(byInvariant5).Lettherebe`leafoccurrencesofband(i`)degree2occurrencesofbinthetrees.Thenthenumberofedgesincidentonbinthetreesis`+2(i`)=2i`;thusare2i(2i`)=`unusededgesincidentonb.Hencethenumberofleafoccurrences`ofbequalsthenumberofunusededgeswithendpointb.5.2ClosureSetsandCorrectnessofSteinermin-cutThegoalofthissectionistodeneclosuresetsprecisely.AssumingInvariants1-5hold,wealsoshowthatifAlgorithm1terminatesinStep2byndingaclosuresetBcontainingawhitevertexfromS,thenBisindeedthedesiredSteinermin-cut.ClosureSet.GivenacomponentCompinTk+1,aclosuresetforCompistheminimalcollectionofblackandwhiteverticesBwiththefollowingproperties:Bcontainsbothwhiteendpointsandallblackverticesintheseedsuperedge,ifoneexists,andthewhitedecientvertexinComp,otherwise.Bdoesnotcontaintherootr.AllofB'swhiteverticesareinComp.ForalltreesTi,vertexoccurrencesinTiofverticesinBarecontiguous.AllunusededgesdirectedintoverticesinBhavebothendpointsinB.Denitions.Inthedescriptionbelow,thetermcurrentgraphdenotesthegraphinwhichsomeverticeshavebeencompressedintoblackvertices,asopposedtotheoriginalgraphwherethisisnotthecase.ForanysetofverticesBinthecurrentgraph,wedenethenumberofcontiguousregionsforBasfollows.ConsiderthegraphRformedbythetreesT1;:::;Tk+1plustheseedsuperedgesforallcomponents,andconsiderthesubgraphinducedbyvertexoccurrencescorrespondingtoverticesinB.ThenumberofconnectedcomponentsinthissubgraphisthenumberofcontiguousregionsforB.Lemma3.ConsideranysubsetofverticesBnotcontainingtherootr.Letxdenotethenumberofcon-tiguousreg

ionsforB,ythenumberofdecientwhitevertic
ionsforB,ythenumberofdecientwhiteverticesinB,andzthenumberofseedsuperedgeswhicharecompletelycontainedwithinacontiguousregion.AssumingInvariants1-5,thein-degreeofBinRisexactlyxzy.Further,ifBcontainsatleastonewhitevertexthenxzyk.Proof.LetodenotethetotalnumberofoccurrencesinRofverticesinB.Eachnon-decientwhiteinBhasin-degreek+1andoccursk+1times,eachdecientwhiteinBhasin-degreekandoccursk+1times,andeachblackhasin-degreeequaltoitsnumberofoccurrences.Sothetotalsumofvertexin-degreesinBisoy.EdgescompletelywithinBcontributetotalin-degreetothetuneofxzlessthano(each13contiguousregioncontributesadeciencyof1buteachseedsuperedgewithinacontiguousregionoffsetsthisby1).Subtractingthisinternalin-degreefromthesumofin-degreesofindividualverticesinB,wegetthatthein-degreeofBinRmustbe(oy)(o(xz))=xzy.IfBhasatleastonewhitevertexthenxk+z+y,wherethersttermcomesfromtreesT1;:::;TkandthelastfromTk+1.Thelemmafollows.Lemma4.AssumingInvariants1-5,properties1-4ofaclosuresetBimplythatBhasin-degreekinRandwellasintreesT1;:::;Tk+1.Proof.LetBbeaclosuresetinacomponentComp.Property1and4implythatx=k+1.Property3impliesthateitherz=1;y=0ory=1;z=0.Sinceproperty2holds,wecaninvokeLemma3;therstpartofthelemmafollows.Thesecondpartabouttreesfollowsfromproperty1.Lemma5.AssumingInvariants1-5,aclosuresetBrepresentsacutofsizekinthecurrentgraph.Further,Brepresentsamin-cutinthecurrentgraphseparatingrfromanywhitevertexinB.Proof.ByLemma4,thein-degreeofBinRisk.Byproperty5,thein-degreeofBinthecurrentgraphiskaswell.Further,sinceBcontainsatleastonewhitevertex,thesecondclaiminthelemmafollowsfrombyLemma3.Lemma6.AssumingInvariants1-5,aclosuresetBrepresentsacutofsizekintheoriginalgraph.Further,Brepresentsamin-cutintheoriginalgraphseparatingrfromanywhitevertexinB.Proof.Clearlyacutinthecurrentgraphinducesacutofthesamesizeintheoriginalgraph(simplyopenuptheblackvertices).SotherstpartofthelemmafollowsfromLemma5.Thesecondpartofthelemmacanbeseenasfollows.Ifthecurrentgraphcomprisesnoblackverticesthenitisidenticaltotheoriginalandthelemmafollows.Sosupposethereareblackverticesinthecurrentgraph,andinductivelyassumethateachofthecorrespondingclosuresetsB0representsamin-cutseparatingrfromwhitesinsideB0intheoriginalgraph.Then,byTheorem7,itfollowsthatforanywhitevertexv,thereexistsamin-cut(separatingvfromr)intheoriginalgraphwhichdoesnotsplitanyoftheblackvertices.Suchacuthasacounterpartinthecurrentgraphaswellofthesamesize.FromLemma5,itfollowsthatclosuresetBrepresentsamin-cutseparatingrfromwhitesinsideBintheoriginalgraphaswel

l.Thelemmafollows.MinimalSteinermin-cut
l.Thelemmafollows.MinimalSteinermin-cuts.WedeneaminimalSteinermin-cut(B;VB)intheoriginalgraphasaSteinermin-cutforwhichthereexistsaterminalvertexvsuchthatv2B,r2VB,andinaddition,nopropersubsetofBcontainingvisaSteinermin-cut.Lemma7.LetkdenotethevalueoftheSteinermin-cut.Acut(B;VB)isaminimalSteinermin-cutintheoriginalgraphifandonlyifBappearsasaclosuresetwhileconstructingTk+1andBcontainsaterminalwhitevertex.Proof.First,supposeBisaminimalSteinermin-cutandletvbetheassociatedterminalvertex.ThenvmustbecomepartofaclosuresetB0whenconstructingsometreeinAlgorithm1.ByLemma6,thattreemustbeTk+1,otherwisethemin-cutseparatingvfromrintheoriginalgraphwillnotbek.Applying1andtheminimalityofB,wecanconcludethatB=B0.Thatshowsonesideofthelemma.Second,supposeBappearsasaclosuresetwhileconstructingTk+1anditcontainsaterminalwhitevertexv.ByLemma6,BisaSteinermin-cutintheoriginalgraph.Itremainstoshowminimality.Consider14anysubsetB0ofBcontainingv.Bythedenitionofaclosureset,Bistheminimalsetwhichsatisesproperties1-5.SoB0violatesatleastoneofthese5properties(inparticular,oneofproperties1,4and5).WeshowthatB0musthavecutsizeatleastk+1.IfB0violatesonlyproperty5,thenLemma4saysthatB0wouldhavein-degreekinthetreesplusatleastoneadditionalin-degreeoutsideamongtheunusededges.SosupposeB0violateseitherproperty1orproperty4.Recalltheparametersx;y;zfromLemma3.Notethatxk+1becausev2B.IfB0violatesproperty1,theny=z=0andxyzk+1.Andifitviolatesproperty4,thenx�k+1andy+zcancontributeatmost1,soxyzk+1.SoB0musthavecutsizeatleastk+1inR,andthereforeinthecurrentgraph,andthereforeintheoriginalgraphaswell.5.3TransformationSequencesWearegivenacollectionoftreesT1;:::;Tk+1satisfyingInvariants1-5andacollectionofcomponentsComp1;:::;ComphinTk+1.Eachcomponenteitherhasanassociatedseedsuperedgeoracollectionofseededges;inthelattercase,alltheseseededgesaredirectedintothesamevertex.Wenowdeneatransformationsequenceforthiscollectionofcomponentsasfollows.ThesewillbethesequencesappliedinStep6ofAlgorithm1.Westartwithe1;:::;eh,eachdenotingeithertheseedsuperedge,ifoneexists,orexactlyoneoftheseededgesfortheirrespectivecomponents,otherwise.Atransformationsequenceisdenedasanysequencecomprisingonlytheoperationslistedbelowandsatisfyingthefollowingadditionalproperties.Eachoftheseoperationsresultsinsometreemodicationswhileupdatingoneortwooftheei's.EacheiiseitherasuperedgeoritisanedgedirectedintoawhiteendpointinComp.AtleastonewhiteendpointofeiisinComp.Theei'sarefree,i.e.,outsideofthecurrenttreesobtainedfromtheoriginalonesviaalrea

dyexecutedtransformations(contrastthesef
dyexecutedtransformations(contrastthesefromunusededges,whicharefreeinitiallybutneednotstayfreeasthesetransformationshappen).TheeventualgoalofdeningatransformationsequenceistoreducethenumberofconnectedcomponentsinTk+1byaconstantfractionwhilemaintainingInvariants1-5.TransformationOperations.Thetransformationslistedbelowincludeswapandincidenceoperations(asinGabow'salgorithm(seeSection3)alongwithmateorre-pairingoperationsillustratedinFig.4.Infact,theoperationslistedbelowcouldbecombinationsoftheseoperations,i.e.,amatefollowedbyaswapetc.Inaddition,thereareoperationswhichcombineapartialsuperedgeinatreewithanunusededge(seeLemma2)tocreateanewsuperedge.1.Swap:Swap-inasuperedgeeiintosometreeandremoveawholesuperedgeforasingleedgefdirectedintoawhitevertexfromitsfundamentalcycle;theswapped-outsuperedge/edgeisthenewei.2.Mate-Swap:MatesuperedgeeiwithasuperedgefinsometreeasshowninFig5.fmustnotbeinthefundamentalcycleofeiandmustshareablackvertexwithei.Matingresultsintwonewsuperedges,bothofwhichareaddedtothetreeinquestion.Fromtheresultingfundamentalcycle,swapouteitherawholesuperedgeoroneedgedirectedintoawhitevertexfromawholesuperedge.Thisresultingedge/superedgereplacesei.15bbbbbbFigure5:Operation2:Therstgureisbeforetheoperationisperformed,andthesecondshowstwocasesaftertheoperationisperformed,namely,onlyanedgeisfreedorawholesuperedgeisfreed.3.Incidence:Replacethegivenedgeeidirectedintowhitevertex,sayw,withanotheredgeoutsideofT1:::Tkande1;:::;ek,directedintow.4.Mate:Matetwosuperedgesei;ejasshowninFig.4;theymusthaveablackvertexincommon.5.Join:Consideranedgeeiwithblackendpointbandsupposeoneofthetreeshasaleafoccurrenceofb(suchanoccurrenceisindeedmandatedbyLemma2).Pulloutthepartialsuperedgeassociatedwithbandappendittoedgeeitoobtainanewsuperedgeei.6.Join-SwapConsideranedgeeiwithblackendpointbandsupposeoneofthetreeshasaleafoccurrenceofb(suchanoccurrenceisindeedmandatedbyLemma2).Swapineiintothistreesuchthatitsendpointbisidentiedwiththeaboveleafoccurrence;fromthisfundamentalcycleswapouteitherawholesuperedgeoroneedgedirectedintoawhitevertex.7.ConnectConsiderasuperedgeeiwhichhasonewhiteendpointinCompj,j=i(recalloneendpointmustalwaysbeinCompi).ThenaddeitoTk+1andcombinethetwocomponentstoyieldanewsetofcomponents.ejbecomestheassociatedsuperedge/edgeforthenewcomponent.Lemma8.ThesetofmodiedtreesT1:::Tk+1andei'sresultingfromatransformationsequencesatisfyInvariants1-5(assumingInvariants1-5holdtobeginwithandassumingoperation7doesnotapplyforanyedgeeiattheendofthesequence).Proof.Invariant2andthe

rstpartofInvariant5areeasilyseentohold.T
rstpartofInvariant5areeasilyseentohold.ThelastpartofInvariant5isvio-latedthough,butitiseasytosweepallleafblackoccurrencesintoT1inO(nk)timeafteralltransformationsaredone.WeshowInvariants1,3and4below.Weneedthefollowingterminologyrst.LetEdenotetheinitialpoolofsuperedges/edgeseiatthebeginningofthesequence,andletSdenotethesubsetthatcomprisessuperedges.LetTdenotetheinitialpooloftrees.LetE0,S0andandT0denotetheirnalcounterpartsattheendofthesequence.NoteSisexactlythesetofseedsuperedgesinitially,andS0isthecounterpartattheendofthesequence.Anexplorationoftheaboveoperationsshowsthatin-degreesinT[Eareidenticaltoin-degreesinT0[E0,andthenumberofblackvertexoccurrencesinT[SisidenticaltothatinT0[S0.Now,ConsiderInvariant4.Notethatin-degreesofblacksinT[EequalsthatinT[S,andlikewisein-degreesofblacksinT0[E0equalsthatinT0[S0(becauseedgesinESaredirectedintowhitesand16likewiseforE0S0).Thusbothin-degreesandblackvertexoccurrencesinT[SareidenticaltothoseinT0[S0.Invariant4follows.Finally,considerInvariants1and3.Thein-degreeofeachwhiteinT[Eisk+1.Therefore,thesameholdsforT0[E0.NowconsiderT0[S0.EachcomponentwithassociatededgeinE0S0hasexactlyonevertexwithin-degreekinT0[S0;allotherwhitescontinuetohavein-degreek+1inT0[S0.SuperedgesinS0havebothendpointswithintheirrespectivecomponents(becauseoperation7doesnotapplyanymore).Invariants1and3follow.Component-SpecicTransformationSequences.AtransformationsequencespecictocomponentCompiisoneinwhichonlyeichangesandallotherej'sstaythesame.Theeventualtransformationsequenceofinterestwillcompriseindividualcomponent-specicsequencesforeachcomponent(asinSection8.1.2)followedbyaportionwheremultipleei'scouldchangesimultaneously(asinSection8.3.2).5.4KeyProceduresNextwedeneinput-outputcharacteristicsofour3keyprocedures.Detailsofeachprocedureappearinsubsequentsections.Weneedthefollowingdenitionsrst.Denitions.GivenasetofblackandwhiteverticesX,letjjXjjdenotethenumberofedgeswithbothendpointsinX.Letw(Comp)denotethenumberofwhiteverticesinComp.ExtendedClosureComputation(Steps2and5).Extendedclosurecomputationwillprocesseachcom-ponentCompindependentlyinarbitraryorder,itresultsinthefollowingoutcomes.EitheritidentiesanewclosuresetBinComp.Or,intheeventthatnewclosuresetsarenotidentiedinanyofthecomponents,itguaranteestheexistenceofatransformationsequence(seeSection5.3)thatreducesthenumberofcomponentsinTk+1byaconstantfraction.Intheformercase,thetimetakenbythisprocedureisO(jjBjj+k)forcomponentComp.Inthelattercase,thetimetakenbythisprocedureisO(nk)overallcomponents.Not

ethatclosurecomputationmakesnochangestot
ethatclosurecomputationmakesnochangestothetreessotheinvariantsstayunaffected.DetailsofextendedclosurecomputationappearinSection7.LocalDegreeBalancing(Step3).GivenacomponentCompandanewblackvertexbCompinComp,thisproceduredoesoneoftwothings.EitheritdeterminesthattherearenomoreclosuresetsinComp.ThetotaltimetakeninthiscaseisO(w(Comp)k).Or,–First,itrearrangesedgesamongstthetreessoeveryoccurrenceofbComphasdegreeatmost2andleafoccurrencesstayinT1.Notethateveryunusededgestaysunusedintheprocess.–Second,itreducesthenumberofoccurrencesofbCompby1andidentiesandreleasesaseedsuperedgeforCompbyjoiningtogethertwopartialsuperedgesassociatedwithleafoccurrencesofbComp.ThisseedsuperedgeisguaranteedtohavebothwhiteendpointsinComp.17–AllchangesmadetoTk+1arewithinComp,i.e.,theconnectedcomponentsinTk+1staythesame.IfanotherclosuresetB0isdiscoveredsubsequentlyinComp(whilerunningclosurecomputationinitiatedbytheseedsuperedgeobtainedafterdegreebalancingbComp),thenthetimetakenbythelocaldegreebalancingstepforBisO(w(B0)k),wherew(B0)isthenumberofwhiteverticesinB0;otherwiseitisO(w(Comp)k).DetailsoflocaldegreebalancingappearinSection6.2.GlobalDegreeBalancing(Step4).GivenacollectionofcomponentsandgivenanewblackvertexbCompineachsuchcomponentComp,thisproceduredoesthefollowing:First,itrearrangesedgesamongstthetreessoeveryoccurrenceofbComphasdegreeatmost2foreverycomponentCompandthenumberofoccurrencesofbCompreducesby1.Notethateveryunusededgestaysunused,andasimpleO(nk)timepassattheendmovesallleafblackoccurrencestoT1.Intheaboveprocess,itreorganizescomponentsinTk+1butguaranteesthatthenumberofcomponentsinTk+1onlydecreasesinthisstep.Next,foreachresultingcomponentComp0inTk+1,itreleasesaseedsuperedgeforComp0;thisseedsuperedgeisguaranteedtohavebothwhiteendpointsinComp0.Finally,foreachresultingcomponentComp0inTk+1,itguaranteesthatthereisnoclosuresetinsideComp0.ThetotaltimetakenbythisprocedureisO(nk).DetailsofglobaldegreebalancingappearinSection6.3.Lemma9.LocalandGlobaldegreebalancingmaintainInvariants1-5(assumingInvariants1-5holdtobeginwith).Proof.LocaldegreebalancinginacomponentCompinTk+1arrangesedgesincidentonablackvertexbdiscoveredinCompsothatthereareexactlykoccurrencesofbafterthisdegreebalancingstepandeachoccurrencehasdegreeatmost2.NocomponentotherthanCompisaffectedbythisstep.NowwewillshowthatInvariants1-5aremaintainedbythisstepforthecomponentComp.1.LocaldegreebalancingidentiesandreleasesaseedsuperedgeforComp.ThusInvariant1ismain-tained.2.ThelocaldegreebalancingalgorithmrearrangesedgesamongthetreesT

1;:::;Tk+1bytakingedges(w;b)incidentonle
1;:::;Tk+1bytakingedges(w;b)incidentonleafoccurrencesofbandmovingthemtotreeswherebhashighdegree.Nowhitevertexwismovedbythisstep,henceeachwhitevertexoccursexactlyonceineachofthetreesT1;:::;Tk+1.3.Aslocaldegreebalancingonlyrearrangesedgesamongthetreesandcreatesaseedsuperedge,localdegreebalancingretainsthetotalin-degreeofeachwhitevertexinthetrees/seedsuperedge.Thusifeachwhitevertex(otherthanr)hastotalin-degreeeitherkork+1priortolocaldegreebalancing,thenthisistrueafterlocaldegreebalancing.184.Invariant4(thetotalnumberofoccurrencesandthetotalin-degreeofeachblackvertexinthetrees/seedsuperedge)isretainedforeveryblackvertexotherthanb,aslocaldegreebalancingonlyrearrangesedgesamongthetrees/seedsuperedge.WenowhavetoshowthatInvariant4ismaintainedforbalso.Therearetotallyk+1occurrencesofbcurrently(oneineachofthetreesT1;:::;Tk+1).IfComp=b,thenthiscomponentisdroppedfromTk+1,thenthereareexactlykoccurrencesofbinthetreeshenceforth.IfComphasverticesotherthanb,thenaseedsuperedgeiscreatedbyjoiningtwopartialsuperedgesedges.Thustwooccurrencesofbaremergedinto1occurrence,thisresultsinexactlykoccurrencesinthetrees/seedsuperedge.Thetotalin-degreeofbinthetreesisequaltokandafterrearrangementofedgesinthetreesandcreationofseedsuperedge,itfollowsthatthetotalin-degreeofbinthetrees/seedsuperedgeisequaltokafterlocaldegreebalancing.5.Localdegreebalancingensuresthateachoccurrenceofbinthetreeshasdegreeatmost2,nootherblackvertexoccurrenceisaffectedbythisstep,andonlyT1hasblackleafoccurrences.Thus,therstpartofInvariant5ismaintained.Globaldegreebalancingworksacrossdifferentcomponentsandthisstepalsorearrangesedgesincidentuponeachmaximalblackvertexwhosedegreeneedstobalancedinthisstepsothateveryoccurrenceofthisvertexhasdegreeatmost2.ItfollowsfromargumentssimilartotheonesgivenaboveforlocaldegreebalancingthatInvariants1-5aremaintainedbythisstep.IdentifyingandExecutingTransformationSequences(Steps5and6).GivenacollectionofcomponentsinTk+1withtheguaranteethateachsuchcomponentCompcontainsnoclosuresets,thisstepdoesthefollowing:First,aconstantfractionofthecomponentsareidentied.Transformationsequencesaredeterminedforeachofthesechosencomponentsinsuchawaythatthesequencesforthevariouscomponentscanbeexecutedindependentlyinanarbitraryorder(soper-formingtransformationsforonecomponentdoesnotrendertransformationsforanothercomponentinvalid).TransformationsequencesforthechosencomponentsarethenexecutedresultinginthenumberofcomponentsinTk+1goingdownbyaconstantfraction.DetailsofexecutingtransformationsequencesappearinSe

ction8.Thetimetakenbythisprocedurewillbe
ction8.ThetimetakenbythisprocedurewillbeO(nk).5.5CorrectnessandComplexityLemma10.Invariants1-5holdatthebeginningofAlgorithm1andattheendofeachstepinAlgorithm1.Proof.RecalltreesT1;:::;Tkareconstructedonebyone,andforeachtreethereareseveralinvocationsofAlgorithm1.Atthebeginningofthealgorithm,whenallwehaveisT1witheachcomponentinT1beingsingleton,theinvariantsclearlyholdwithk=0.SoafterconstructingT1;:::;TkandwhileconstructingTk+1,letusassumetheinvariantsholdatthebeginningofaparticularinvocationofAlgorithm1,andshow19thattheycontinuetoholdaftereachstep.Lemmas10and11showthatthestepslocaldegreebalancing,globaldegreebalancing,andexecutingtransformationsequencesmaintainInvariants1-5.Theextendedclosurecomputationstepdoesnotmodifyanytrees.ThusInvariants1-5holdattheendofeachstepinthealgorithm.Lemma11.ThetotaltimetakenforoneinvocationofAlgorithm1isO(nk)=O(nk).Proof.FirstconsiderStep2.ThetimetakeninaniterationofStep2isO(jjBjj+k)ifaclosuresetBisdiscovered;andthetimetakenoverthelastiterationsofStep2overallcomponentsisO(nk).Itremainstoaccountforallbutthelastiterationsforeachcomponent.NotethatjjBjjaddedupoverthevariousclosuresetsisO(m)becausenoedgecountsintwooftheclosuresets(becauseaclosuresetiscompressedtoablackvertexforfutureuse).AndthepluskaddsuptoO(nk)becauseeachclosuresetcontainsatleastonewhitevertex.Letusnowestimatethetimetakenforlocaldegreebalancing.ConsidercomponentsCompandletB1;:::;Bhdenotethevariousclosuresetsobtainedinsuccessiveiterations.ThetimecomplexityisO(Ph2w(Bi)k)+O(w(Comp))k.ThissumstotoO(w(Comp)k)forCompandO(nk)overall.GlobaldegreebalancingsummedoverallcomponentstakesO(nk)time.IdentifyingandexecutingtransformationsequencestakesO(n+m)timeoverallcomponents.ThusthetimetakenforaroundtoconstructTk+1isO(n+m).NotethatmcanbeboundedbyO(nk)byusingNIpreprocessingstep.ThusthetimetakenforaroundisO(nk).Theorem9.AllminimalSteinermin-cutsforthespeciedterminalvertexsetSwithrespecttotherootcanbedeterminedintimeO(mklogn)=O(nk2logn+m),wherekisthesizeoftheSteinermin-cut.Proof.EachroundreducesthenumberofcomponentsinTk+1byaconstantfraction.ThusO(logn)roundsarerequiredtobuildtreeTk+1andaseachroundforTk+1takesO(nk)time(byLemma11),thetotaltimetobuildTk+1isO(nklogn).HencethetimetakentobuildtreesT1;:::;Tk+1(duringtheconstructionofTk+1werealisethattheSteinermin-cutisk)isO(nk2logn).CorrectnessfollowsfromLemma7.Theorem10.GivenanysubsetXofvertices,theminimalmin-cutseparatingvfromthechosenrootrcanbefoundforallverticesv2XintimeO(mklogn)=O(nk2logn+m),wherekisthevalueofthelargestoftheseminima

lmin-cuts.Proof.ByLemma7,constructingk+1
lmin-cuts.Proof.ByLemma7,constructingk+1treessufcestondthesemin-cuts.ThetimetakentobuildtreesT1;:::;Tk+1isO(nk2logn).6Degree-BalancingSubroutinesLetBdenoteaclosuresetdiscoveredforComp.WecontractBintoasinglevertexbandthenwedegree-balanceb,i.e.were-distributesuperedgesincidentonbsuchthateachoccurrenceofbinT1;:::;Tk+1hasdegreeatmost2.Recallthatoncewedegree-balanceb,wealsogetaseedsuperedgecontainingbtoresumetheclosurecomputationprocedureonComp.6.1DecisionProcedureforSelectingDegree-BalancingSubroutineFirst,weneedthefollowingdecisionproceduretodeterminewhethertorunlocalorglobaldegreebalancing.WeconsidereachtreeTiinwhichtheoccurrenceofbhasdegreegreaterthan2andrunthefollowingprocedure.20ConsideranoccurrenceofbintreeTiwithdegreed+2;d�0,andletu1;:::;ud+2betheotherwhiteendpointsofthesuperedgesincidentonbinTi.Sincebcurrentlyhask+1occurrencesoverallandtotaldegree2kinthetreesT1;:::;Tk+1,thereexistdleafoccurrencesofbwhichcanbeuniquelyassignedtothisoccurrenceofdegreed+2(seeLemma2).WeremovethedsuperedgesincidentonthesedleafoccurrencesfromtheirrespectivetreesandaddthemtoTi(notethatbisanewblack,sowecallthesesuperedgesandnotpartialsuperedgeswhendegreebalancingisinprogress).Lettheresultingsuperedgesbee1;:::;edandtheirwhiteendpoints(i.e.theendpointsotherthanb)bew1;:::;wd.EachejcausesafundamentalcyclebetweenbandwjinTi.Ourgoalistocheckwhetherthereisanyexternalwhitevertexonthesedfundamentalcycles.Wedothisasfollows.Wetraverseupwardsfromeachofthewi'sandfromb,progressingeachtraversalinaround-robinmannerandmarkinganywhiteverticestraversed.Wetraverseonlywhiteverticesandskipoverblackverticesinternaltosuperedges.Foreachtraversal,wesayitissuccessfulifithitsapreviouslymarkedwhitevertexorhitsb,andwesayitfailsifithitsanexternalwhitevertex.Aparticulartraversalhaltswhenitencounterseithersuccessorfailure.Thewholeprocedurestopsifeitherallbutonetraversalhavesucceededorwhentwoofthetraversalshavefailed.Intheformercase,itiseasilyseenthatallwhiteverticesintheabovefundamentalcyclesarewithinComp.Andinthelattercase,thereisatleastoneexternalwhitevertexinthesefundamentalcycles.Theaboveprocedureisrunonallrelevanttrees.Ifthelattercaseholdsforanyofthesetrees,thenweruntheglobaldegreebalancingprocedureforb,andotherwisewerunthelocaldegreebalancingprocedure.Lemma12.Ifoneoftheabovefundamentalcycleshasanexternalwhitevertex,thenifthenextiterationofStep2forCompinAlgorithm1weretoberun,itwouldnotndaclosureset.Proof.Wewillshowthattheseedsuperedgeyieldedbydegreebalancingbwillcontainanoccurrenceofb.Andclearly,itwi

llhaveawhiteendpoint.Itfollowsfromproper
llhaveawhiteendpoint.Itfollowsfromproperty4inthedenitionofclosuresetsthatanyclosuresetforCompwillthenneedtocontainallthewi'saswell.Property3willthenbeviolated.Lemma13.IntheeventthatallwhiteverticesintheabovefundamentalcyclesareinsideComp,allofthesewhiteverticesareinsideanyfutureclosuresetsthatAlgorithm1discoversinComp.Proof.FollowsasintheproofofLemma12.IfallwhiteverticesintheabovefundamentalcyclesareinCompthenthetimetakenbytheaboveprocedureisproportionaltothenumberofthesewhitevertexoccurrences.ByLemma13,thisisproportionaltow(B0)k,ifthereisasubsequentclosuresetB0foundforComp,andw(Comp)kotherwise.Andifthereisanexternalwhitevertexinoneofthefundamentalcycles,thenthetimetakenisproportionaltothenumberofoccurrencesinthefundamentalcyclesofwhiteverticesfromComp,whichisw(Comp)k,asrequired.6.2TheLocalDegreeBalancingAlgorithmConsidertheoccurrenceofbinTiwithdegreed+2wherewealsoaddeddsuperedgese1;:::;edincidentuponbfromothertrees.Wewillmatcheachoftheedgese1;:::;edwithoneoftheedgesincidentontheaboveoccurrenceofbusingthealgorithmdescribedbelow.Asthereared+2+d=2d+2edgesincidentuponb,ouralgorithmmakesdpairsfromthese2d+2edgessothatbycreatingdnewoccurrencesofbandmakingeachnewoccurrenceofbadegree2occurrenceusingthepairing,Tiremainsconnected.Notethattheoriginaloccurrenceofbalsohasdegree2(since2d+22d=2)now.ThusTiwillhaved+121A2A3A4BBw1w2w1w2Figure6:LocalbalancingblackvertexBinatreeoccurrencesofbnow,eachwithdegree2.Notethatthetotalnumberofoccurrencesofbremainsk+1inthisprocess(dleafoccurrencesarereplacedbydnewoccurrencesinTi)(seeFigure6foranexample).DeneCycEdg(ej)tobethatneighbor(awhitevertex)u`ofbinTisuchthatthesuperedge(b;u`)isinthefundamentalcycleofej.OurtraversalsdescribedarealsousedtocomputeCycEdg()foreachofe1;:::;ed.Foranytraversalwhichterminatedinb,thecorrespondingCycEdg()isthelastwhitevertexen-counteredbeforeb.Foranytraversalthatterminatedinavertexmarkedbyb,thecorrespondingCycEdg()istherstwhitevertexencounteredafterbinthetraversalfromb.Finally,foranytraversalthatterminatedinavertexmarkedw=b,thecorrespondingCycEdg()isthesameasCycEdg(ew),whereewisthesu-peredgebetweenbandw.Wenowtakee1andmatchittoanysuperedgeotherthan(b;CycEdg(e1));forinstancesupposewematchittothesuperedge(b;uh).(Notethatsuchasuperedgealwaysexistssinceatanystage,theoccurrenceofbwithdegreemorethantwohasatleast2neighborsmorethanthenumberofejsleft.)ForallthoseejwithCycEdg(ej)=uh,wenowredeneCycEdg(ej)tobeCycEdg(e1),andthenrepeattheaboveprocedureuntilalltheedgese1;:::;edarematched.Lemma14.Theabovetransformati

onskeepTiconnected.Proof.Weuseinductiono
onskeepTiconnected.Proof.Weuseinductiononthesequenceoftransformations.SinceTiisinitiallyconnected,thebasecasefollows.Supposeafterasetoftransformations,Tiisconnected.Sinceweensurethatwedonotpairthenextsuperedge(sayej)with(b;CycEdg(ej))whereCycEdg()isdenedaccordingtothecurrentcongurationofTi,Tistaysconnected.Aftertheaboveprocedureiscompletedforalloccurrencesofb,eachoccurrenceofbhasdegreeatmost2.Wenowtakeapairofdegree1occurrences,callthem(u;b)and(v;b),tocreatethenewsuperedge(u;v),whichistheseedsuperedgetoresumetheclosurecomputationforComp.(Notethatthenumberofoccurrencesofbinthetreesandseedsuperedgetakentogetherisnowk.)Allremainingdegree1occurrencesaremovedtoT1.WeknowthatuandvarewhiteverticesinCompsincepriortolocaldegreebalancingwetraversedtheedgesincidentonbandfoundnoexternalwhitevertices.Runningtime.InitializingthevalueofCycEdge()foreachofthedleafsuperedgesisdoneduringthetraversalsandtakethesametime(i.e.,O(nk)overall)asthetraversals.InordertoupdatethefunctionCycEdge(),weusetheunion-nddatastructure.Thus,thetimetakenhereisO( d)where istheinverse22Ackermannfunction.Addingoverallthetrees,thisisO( k).Summingovertheentirealgorithm,thisbecomesO( m).Thisfollowsfromthefactthatthesumofin-degreesofalltheblacksoverallthetreesatanystageofouralgorithmisatmost2m.Lemma15provesthisclaim.Lemma15.PbC(b)2m,wherethesumisoveralltheblackverticesbthatarediscoveredduringthealgorithm.Proof.Consideranyblackvertexb.ThisisasubsetBofverticesthatgetscontractedtoasinglevertex.Thereisatleastonewhitevertexw2BthatwasthedecientvertexinthecomponentCompofBthattriggeredtheclosurecomputationinCompwhicheventuallyledtotheformationofthecut(VB;B).Notethat(VB;B)isaminr-wcut,thusthevalueofthiscutisboundedfromabovebythedegreeofw.ThusPbC(b)isboundedfromabovebythesumofdegreesofallverticesinG,whichis2m.6.3TheGlobalDegreeBalancingAlgorithmWenowdescribeasingleglobalprocedurefordegreebalancingallthoseblackvertices(thesearenecessarilymaximalintheirrespectivecomponents)whereweencounteredanexternalwhitevertexduringthetreetraversalsdescribedearlier.ThisprocedureisglobalinthesensethatithandlesallsuchmaximalblackverticesinvariouscomponentsofTk+1together;theassociatedtreetraversalswillnolongerbeconnedtotherespectivecomponents.ConsideranytreeTiandletB=fb1;:::;brgbethesetofblackverticesinTiinneedofglobaldegreebalancing.Also,letdj�2denotethedegreeofbjinTi,andletd=Prj=1(dj2).Recallthatforeachbj,ourgoalistopairthesuperedgescorrespondingtothedj2leafoccurrencesofbjthatwehaveaddedtoTi(wecalltheseleafsuperedges)

withthesuperedgesincidentonbjthatwerealr
withthesuperedgesincidentonbjthatwerealreadypresentinTi(wecallthesetreesuperedges).Thiswillresultresultingindj1occurrencesofbj,eachwithdegree2.TheconditionforpairingaboveisthatTishouldstayconnected(orifi=k+1,thenthenumberofconnectedcomponentsshouldnotreduce).Thiscondition,whichisthesameasthatforlocaldegreebalancing,requiresthateachleafsuperedgeeincidentonbjbepairedwithatreesuperedgefincidentonbjsuchthatfisnotinthefundamentalcycleofeinTi.Weshowbelowhowthiscanbeachievedsimultaneouslyforalltheverticesb1;:::;brinO(n)time,givingO(nk)timeperroundoverallthek+1trees.Weneedthefollowingdenition.DescendantSubtrees.Adescendantsubtreeofbj2Bisasubtreerootedatanychildvofbj(wherevisawhitevertex).Thus,bjhasdj1descendantsubtrees.SupposebjhasadescendantsubtreerootedatawhitevertexvwhichneithercontainsanyothervertexinB,northeendpointofanyleafsuperedgeaddedtoTi.(Suchadescendantsubtreeiscalledafriendlydescendantsubtree.)Then,wecanpairthesuperedge(bj;v)withanyoftheleafsuperedgesincidentonv(say(w;v))whilekeepingtreeTiconnected.Asanadditionaladvantage,theentirefriendlydescendantsubtreealongwiththewbvsuperedgecannowbecontractedintothevertexvfortheremainingpartoftheproceduresincethissubtreewillremainunchangedirrespectiveofthepairingofsuperedges(refertoFigure7(a)).Thispropertywillprovecriticalinshowingtheefciencyofourprocedure.Ourprocedure,therefore,isthefollowing.Initiallyallleafsuperedgesareunmatched;also,initially,allblackverticesinBhavedegreegreaterthan2,andthisdegreereducesaspairinghappens,eventuallyresultinginalloccurrenceshavingdegree2.Wendafriendlydescendantsubtree,pairthecorrespondingtreesuperedgewithanyleafsuperedgeandcontracttheentiresubtreealongwiththesuperedgeformedbyjoiningthetreeandleafsuperedge.Wethenrepeattheprocedureforanewfriendlydescendantsubtree.WeterminatewhenalltheblackverticesinBhavedegree2ineachoccurrence.23(b)wbjSvbjwwb1v1b2v2v3v4b5v11v9b3v5b4v8v7v6v10vS(a)Figure7:(a)ThetransformationinoneiterationwhereSisafriendlydescendantsubtree.TherststepperformsthedegreebalancingandthesecondstepcontractthesubtreeSalongwiththesuperedge(w;v);(b)Themappingisasfollows(Siisthedescendantsubtreerootedatvi):S1ismappedtoeitherb2orb5,S3ismappedtoeitherb3orb4,allotherdescendantsubtreeshaveanemptymap.24Lemma16.TherealwaysexistsafriendlydescendantsubtreeintreeTiduringtheaboveprocedure.Proof.Weprovethepropertyatthestartoftheprocedure;sincetheproofisbasedonacountingargumentandboththedegreeandthenumberofunmatchedleafedgesdecreasesby1aftereachiteration,theproofcontinuestoholdsubseq

uentlyduringthecourseofthealgorithm.Letu
uentlyduringthecourseofthealgorithm.Letusdeneamappingfromeachdescendantsubtree(callitSandletitberootedatawhitevertexv)toablackvertexbjinBwiththefollowingproperty:bjisinthedescendantsubtreeS,i.e.bjisadescendantofvinTiandnootherblackvertexinBispresentonthepathfromvtobj(refertoFigure7(b)).Fordescendantsubtreeshavingmultipleblackverticessatisfyingtheaboveproperty,weselectanysuchblackvertexarbitrarily.Ontheotherhand,fordescendantsubtreesnotcontaininganyblackvertexinB,theabovemappingisempty.Weareinterestedincountingthenumberofdescendantsubtreeswhosemapisemptyfortheabovemapping.ThecriticalpropertyofthemappingdenedaboveisthatnotmorethanonedescendantsubtreecanmaptothesameblackvertexbjinB,sinceotherwise,oneoftheblackverticescorrespondingtothedescendantsubtreesisbetweenbjandtherootoftheotherdescendantsubtree.Further,thereisatleastoneblackvertexblinBwhichisnotthedescendantofanyotherbjinB;therefore,blisnotinanydescendantsubtreeandnodescendantsubtreemapstoblbytheabovemapping.Thus,atmostr1descendantsubtreeshaveanon-emptymapbytheabovemapping.Now,thetotalnumberofdescendantsubtreesoveralltheblackverticesinBisPrj=1djr.Thus,atleastPrj=1dj2r+1descendantsubtreesdonotcontainanyblackvertexinB.SincetherearePrj=1(dj2)unmatchedleafsuperedges,eachwithonewhiteendpoint,atleast1oftheabovedescendantsubtreesneithercontainsanyblackvertexinB,norhasanywhiteendpointofanunmatchedleafsuperedge.LetthisfriendlydescendantsubtreeSberootedatachildvofablackvertexbj2B;thentheedgeconnectingbjtovispairedwithanyoftheleafedgesforbj,causingthisleafedgetobecomematched,causingthedegreeofbjtoreduceby1,andcausingStobecomecompressedtoasinglevertexandnolongerbeconsideredadescendantsubtree.ThealgorithmsimplyrepeatsthisprocessuntildegreesforallverticesinBaredownto2.Wewillnowshowthatwecanimplementtheabovealgorithmefciently,namelywecanndafriendlydescendantsubtreeineachiterationusingO(n)timeoveralliterations.Weperformapost-ordertraversaloftreeTi,whereeachwalkupfromtheleavesstopswhenwehaveoneofthefollowingconditions:Wereachthewhiteendpointvofanunmatchedleafsuperedge.Wereachachild(whitevertex,sayw)ofablackvertex(saybj)inB.Intherstcase,thetraversalwaitsatvuntiltheleafsuperedgeincidentonvismatched.Inthesecondcase,weareguaranteedthatthesubtreeatwisafriendlydescendantsubtree.Thus,wematchthe(w;bj)treesuperedgewithanyleafsuperedgeincidentonbj.Afterthematching,oneofthefollowingtwosituationshappens:eitherbjstillhasadegreegreaterthan2,inwhichcasethewalkwaitsatbj,orbjnowhasadegreeof2inwhichcasethewalkcontinuesupwardtothepa

rentofbj.Thus,atanystage,wehaveasetofwal
rentofbj.Thus,atanystage,wehaveasetofwalkswaitingatwhiteendpointsofleafsuperedgesoratblackverticesinBwithdegreegreaterthan2.Theabovelemmahoweverensuresthatatanystagewealwayshaveatleastonewalkthatdoesnotgetstuck,namelythewalkinthefriendlydescendantsubtree.RunningTime.Sinceeachfriendlydescendantsubtreeiscontractedafterthesuperedgepairing,nosu-peredgeinthetreeistraversedmorethanonce.ThisensuresarunningtimeofO(n)foronetreeandO(nk)overT1;:::;Tk+1.25WehavealreadynotedthatanytreeTistaysconnectedaftertheaboveprocedure.However,recallthatTk+1isactuallyaforest;wenowshowthatthenumberofcomponentsinTk+1remainsunchangedduringglobaldegreebalancing.Lemma17.LetxbethenumberofcomponentsinTk+1beforeglobaldegreebalancing.AtanypointoftimeduringglobaldegreebalancingonTk+1,thenumberofcomponentsinTk+1isx.Proof.Weprovethisbyinduction.Assumethattheclaimholdsbeforeanyparticularchange.Clearly,ifacomponentsplitsintotwofragments,thenoneofthetwofragmentsisattachedtoanalreadyexistingcomponentatthewhiteendpointoftheleafsuperedge.Anentirecomponentdoesnotgetincorporatedinanothercomponentbecausethemaximalblackvertexinthiscomponentretainsanoccurrencewithdegreeof2inthecomponent.Thusthetotalnumberofcomponentsremainunchanged.Afterglobaldegreebalancing.Letbbeablackvertexthathasjustundergoneglobaldegreebalancing.Thuseveryoccurrenceofbhasdegreeatmost2.Recallthattherearecurrentlyk+1occurrencesofbinthetreesT1;:::;Tk+1andthetotaldegreeofalloccurrencesofbis2k.Wehavethefollowingtwocasesnow.AlltheoccurrencesofbinT1;:::;Tkaredegree2occurrences.ThenbisanentirecomponentintheforestTk+1.Inthiscase,wedeletethecomponentbfromTk+1.SobnowhaskoccurrencesinT1:::Tk+1.bhasleafoccurrencesinsomeofT1;:::;Tk+1.Sincebhask+1occurrencesinthesetreesandtotaldegree2k,thereareatleast2leafoccurrencesofbinT1;:::;Tk+1.Wedetachtwoleafsuperedgesincidentonbandpairthemwitheachother;thissuperedgebecomestheseedsuperedgeforthecomponentCompcontainingb.Let(x;y)bethisseedsuperedge.Wehavethefollowingpossiblesituations.1.BothxandybelongtoComp:thenStep5(closurecomputation)ofAlgorithm1needstoberunonCompinitiatedwith(x;y)astheseedsuperedge.2.BothxandybelongtosomeothercomponentComp0:thenweperformamatebetweentheseedsuperedge(x;y)andthesuperedge(u;v)thatcontainsbinComp.Theresultingsuperedgesfromthemate((x;u)and(y;v))connectCompandComp0andnofurtherprocessingisre-quiredforeitherComporComp0inthisround.3.Oneofx;ybelongstoCompandtheotherbelongstoanothercomponentComp0:thentheseedsuperedgeisaddedtoTk+1toconnectCompandComp0;nofurtherprocessingofeitherComporComp

0isrequiredinthisround.4.Neitherxnorybel
0isrequiredinthisround.4.NeitherxnorybelongstoCompbuttheybelongtodifferentcomponents:thenwematetheseedsuperedgewiththeedgecontainingbinCompandaddtheresultingedgestoTk+1.ThissplitsCompintotwopartsandthetwopartsgetattachedtoComp0andComp00(thecomponentsthatxandyrespectivelybelongto)respectively;nofurtherprocessingofeitherComp0orComp00isrequiredinthisround.SincethecomponentsinTk+1mightbere-organizedbyglobaldegreebalancingasshownabove,wenowneedtoshowthatweonlyneedtoruntheclosurecomputationprocedureonlyonceforeachnewcomponentinTk+1.26Lemma18.Theclosurecomputationprocedureperformedafterglobaldegreebalancingdoesnotleadtoacutofsizekinanycomponent.Proof.First,consideracomponentCompwhereaclosurecomputationearlierfoundanexternalvertex(andnotanewk-cut).Ifanewk-cutCisfoundbytheclosurecomputationnow,thenCclearlycontainsatleastonewhitevertexwhichhasbeenbroughtintoCompfromsomeothercomponentbytheglobaldegreebalancingprocedure(otherwise,theearlierclosurecomputationshouldalsohavefoundthisk-cut).SinceCiscontiguousinTk+1,CmustalsocontainablackvertexbwhichwasbroughtintoCompbyglobaldegreebalancing.Further,theremustbeanothercomponentofTk+1whichcontainsatleastoneoccurrenceofb,namely,thecomponentwherebwasidentiedasablackvertexintherstplace.Thus,someoccurrenceofb(specically,anoccurrenceinComp)isinCwhilesomeotheroccurrence(specically,anoccurrenceintheoriginalcomponentofb)isnotinC.ThisviolatesthedenitionofC.Next,weconsideracomponentCompwhichunderwentglobaldegreebalancingforablackvertexb.Forthiscomponent,iftheclosurecomputationndsanotherk-cutC,thenCmustcontainbsincetheclosurecomputationisinitializedwithaseedsuperedgecontainingb.ByLemma12,bisamaximalblackvertexinComp(consideringthecompositionofCompbeforeglobalbalancing).Thus,forCtobeak-cut,itmustcontainwhiteverticeswhichhaveenteredCompfromothercomponentsduetoglobaldegreebalancing.SinceCiscontiguousinTk+1,Cmustalsocontainablackvertexb0whichwasbroughtintoCompbyglobaldegreebalancing.TheremustbeanothercomponentofTk+1whichcontainsatleastoneoccurrenceofb0,namely,thecomponentwhereb0wasidentiedasablackvertexintherstplace.Thus,someoccurrenceofb0(specically,anoccurrenceinComp)isinCwhilesomeotheroccurrence(specically,anoccurrenceintheoriginalcomponentofb0)isnotinC.ThisagainviolatesthedenitionofC.7ExtendedClosureComputationDetailsWearegivenacollectionoftreesT1;:::;Tk+1andcomponentsComp1;:::;ComphinTk+1withassoci-atedseedsuperedges/seededgessatisfyingInvariants1-5.Behaviour.Extendedclosurecomputationwillprocesseachcomponentindependentlyinarbit

raryorder,andisdescribedinAlgorithm2foro
raryorder,andisdescribedinAlgorithm2foronesuchcomponentComp.Itresultsinthefollowingoutcomes.EitheritidentiesanewclosuresetCinComp.Or,intheeventthatnewclosuresetsarenotidentiedinanyofthecomponents,itguaranteestheexistenceofatransformationsequence(seeSection5.3)thatreducesthenumberofcomponentsinTk+1byaconstantfraction.Intheformercase,thetimetakenbythisprocedureisO(jjCjj+k)forcomponentComp.Inthelattercase,thetimetakenbythisprocedureisO(nk)overallcomponents.Notethatextendedclosurecomputationitselfdoesnotmakeanytransformations,itmerelyguaranteestheexistenceofatransformationsequenceasabove.AlsorecallthatwhencalledfromStep5inAlgorithm1,thesecondcaseabovewillholdforallcomponents(seeLemma18).Inthatcase,Step6inAlgorithm1actuallyidentiesandexecutestheassociatedtransformationsequences;thatprocedureisdescribedinsubsequentsections.VerticesandVertexOccurrences.WeusethetermvertexoccurrenceforawhitevertexvtodenoteaparticularoccurrenceofvinthetreesT1;:::;Tk+1,andforablackvertexvtodenoteaparticularoccurrenceofvinthetreesT1;:::;Tk+1ortheseedsuperedges.27Outline.Step7istheheartofAlgorithm2.ThewholealgorithmperformsseveralinvocationsofStep7,whereeachinvocationinvolvestraversingthepathbetweensomevertexoccurrencev0(blackorwhite)toCiinsometreeTi,whereCiisasetofcontiguousvertexoccurrencesinTi.AllvertexoccurrencesencounteredonthispatharethenaddedtoCi.TheyarealsoaddedtoCsotheycanusedforinitiatinginvocationsofStep7inothertrees.NotethatCisasetofverticeswhileCi'scomprisenotverticesbutvertexoccurrences.AnothersourceofadditionstoCisStep9whichlooksatunusededgesoutsidethetrees.Awhitevertexwissaidtobeincidence-readyifthereexistsanedgedirectedintowinsometreeTi,1ik+1,withbothendpointsoftheedgeinsideCi.TheorderofadditionstoCi;CinStep7andtheorderofprocessingverticesinStep4andintheforloopafterstep4areimportantandwillbeusedinLemma23forgeneratingtransformationsequences.NotethatforallothercomponentsComp0,weuseexplicitsuperscriptsfortheircorrespondingCi;C,i.e.,CComp0i;CComp0.Algorithm2ExtendedClosureComputationforComponentComp0.Letubeanyendpointoftheseedsuperedge,ifitsexists,andthecommonwhiteendpointoftheseededges,otherwise.1.InitializeCtoallblackandwhitevertices(andnotvertexoccurrences)whichoccurintheseedsuperedgeoralltheseededges,asthecasemaybe.2.InitializeCitovertexoccurrenceuforeachtreeTi;1ik+1.repeatforeachtreeTi;1ik+1inorderdo3.LetXdenotethesetofverticesinCwhichhavevertexoccurrencesinTioutsideCi.4.OrderverticesinXsowhitescomerst,blackslater,andeachsetisfurthersortedinincreasingtimeorde

rofentryintoC.foreachvertexv2Xinorderand
rofentryintoC.foreachvertexv2Xinorderandeveryoccurrencev0ofvinTi(inarbitraryorder,exceptinT1whereleafoccurrences,ifany,areconsideredrst)do5.IfthepathbetweenCiandv0inTicontainsawhitevertexoutsideComp,thenterminatethealgorithm.6.IfvisblackandeitherhasanoccurrenceintheseedsuperedgeforsomeothercomponentComp0,ortheoccurrencev0ispresentinCComp0iforapreviouslyprocessedcomponentComp0,thenterminatethealgorithm.7.AddallwhiteandblackvertexoccurrencesbetweenCiandv0toCiinorderofincreasingdistancefromCiandaddthecorrespondingverticestoCinthesameorder.endforendfor8.Identifyallwhiteverticeswwhicharenewlyincidence-ready,i.e.,incidence-readynowbutnotattheendofthepreviousiterationoftherepeatloop.9.Identifyallverticesw0suchthatthereexistsanunusededgefromw0directedintow,wherewisnewlyincidence-ready;addw0toCifeitherw0isblackoritiswhiteandbelongstoComp,otherwiseterminatethealgorithm.untilCconverges,i.e.,doesnotchangeinaniterationoftherepeatloopLemma19.ForeachtreeTi,thevertexoccurrencesinCiarecontiguousinTi.FurtherCicontainsatleastonewhitevertex.Proof.Cistartswiththesinglevertexoccurrenceu.ForeachsubsequentadditiontoCiinSteps7,allinterveningvertexoccurrencesarealsoaddedtoCi.28Lemma20.ThetimetakenbytheaboveprocedureisproportionaltoO(jjCjj+k)ifCconverges.AndifterminationhappensinSteps5,6or9,thetimetakensummedoverallcomponentsisO(nk).Proof.ThechecksinStep6areeasilyimplementedinO(1)timebymarkingvertexoccurrencesappropri-ately(noteeachvertexoccurrencecanbeintheCiforatmostonecomponentbyvirtueofStep6).ThetimeforStep8isdominatedbySteps5,7becauseonecantrackincidence-readinesswhentwoendpointsofanedgeareaddedtoCi.Soconsidertwocasesfortheremainingsteps.First,supposeCconverges.Step2takestimeO(k).ForSteps1,5,7,9,eachunitoftimespentinthesestepscanbechargedtoanedgecompletelywithinC,sothistimeisO(jjCjj).Second,supposeCdoesn'tconverge.Then,thetimesareasfollows,asidefromtheO(1)timespentontheterminatingvertex.Thetimetakeninsteps2,5,7isPk+11O(jCij)+O(w(C))(eachunitoftimespentcanbechargedtoanadditiontoCiortoawhitevertexinComp).ForSteps1and9,thetimetakenisproportionaltothenumberofedgesdirectedintowhiteverticesinCompplusthelengthoftheseedsuperedge.ByLemma22,Pk+11jCijaddsuptoO(nk)overallcomponents.TheothertermsclearlyadduptoO(nk).ThisleavesSteps3and4.ItsufcestoshowthatthisstepcanbeperformedintimeO(jXj)(becauseatleastO(1)timewillbespentinprocessingeachiteminXinSteps5,6,unlessterminationhappensinthesestepswhenprocessingX,inwhichcasethiscostcanbechargedtotheentryintoCofthecorrespondingverticesinSteps7or9).Toa

chieveO(jXj)time,wekeeptwoqueueswitheach
chieveO(jXj)time,wekeeptwoqueueswitheachtree.EachtimeavertexvnotalreadyinCisaddedtoCitisputintothesecondqueueforthenexttree(incyclicorder)thathasanoccurrenceofv.AndeachtimeavertexvinXisprocessedintheinnerforloopitisputintotherstqueueforthenexttree(incyclicorder)thathasanoccurrenceofv,providedvhasnotgonethroughafullcyclicround.Xforatreeisthenobtainedsimplybycombiningthecontentsofthetwoassociatedqueuesforthattree.Bykeepingthequeuessegregatedbyblacksandwhites,theorderingrequiredinStep4canbeachieved.Thelemmafollows.Lemma21.IftheextendedclosurecomputationprocedureforCompterminatesbecauseCconverges,thenCisaclosureset.Proof.Recallproperties1-5ofclosuresetsfromSection5.2.Theseareshownasfollows.Property1followsfromtheinitializationofC.Properties2and3followsfromthefactthatAlgorithm2addsonlywhiteverticeswithinComptoC.Property4comesfromLemma19.Property5isshownbelow.WeneedtoshowthatallunusededgesdirectedintoChavebothendpointsinC.Supposethisisnottrueforanunusededgedirectedintovertexw2C.Thenwneverbecomesincidence-readyandtherefore,ineachtreeTi,alltreeedgesdirectedintowhavetheirotherendpointsoutsideCi.ByLemma4,therst4propertiesaboveimplythatthereareonlykedgesdirectedintoCinthetrees.Sothein-degreeofwinthetreesplusseedsuperedge(ifany)mustbek,i.e.,wisdecient.Then,byinitializationinStep1,allunusededgesdirectedintowhavebothendpointsinC,acontradiction.Finally,weneedtoshowthatCisminimal,i.e.,nosubsetofCsatisesallthepropertiesofaclosuresetforComp.ThisiseasilyseenbecauseAlgorithm2startswithverticesneededtosatisfyInvariants1and5,andaddsverticesonlyifInvariant4isviolated.ItremainstoshowthatiftheextendedclosurecomputationprocedureterminatesinSteps5,6or9foreachofthecomponents,thenthereexistsatransformationsequence(seeSection5.3)thatreducesthenumberofcomponentsinTk+1byaconstantfraction.WeshowhowtoalgorithmicallyobtainsuchatransformationsequencenextintimeO(nk).298ObtainingaTransformationSequenceTherearetwophasestothisprocedure.Phase1considerseachcomponentCompindependentlyandobtainsacomponent-specictransformationsequence(thegoalistogetwithinafewtransformationsofhavingoneendpointoutsideComp).ThetimetakenbyPhase1willdominatedbytheclosurecomputationtimeabove.Phase2considersallcomponentstogetherandaddsfurthertransformationstodecreasethenumberofcomponentsinTk+1byaconstantfraction.ThetimetakenbyPhase2willbeO(nk).Phase1forcomponentCompitselfdependsuponwhichstepinAlgorithm2causestermination.IfterminationiscausedinStep6bysomevertexoccurrencev0belongingtoCComp0iforsomepreviouslyprocessedcomponen

tComp0thenwesaythatCompispremature.Andif
tComp0thenwesaythatCompispremature.AndifterminationiscausedeitherinStep6bysomevertexoccurrencev0belongingtotheseedsuperedgeforanothercomponentComp0,orinSteps5or9duetoawhitevertexoutsideComp,wesayCompismature.Phase1willbedescribedseparatelyforthesetwotypesofcomponents,inSections8.1and8.2,respectively(thematurecaseisthesimplerone,theprematurecasewillneedmoreprocessing).Section8.3describesPhase2.Weneedthefollowingusefullemma.Lemma22.ForalltreesTi,1ik+1,andallpairsofcomponentsComp0;Comp00,thesetsCComp0iandCComp00iaredisjoint.Proof.ThisfollowsfromtheterminationconditionsinSteps5and6ofAlgorithm2.8.1Phase1:Component-specicTransformationSequenceforMatureComponentCompNotethatmaturecomponentshaveoneofthefollowingterminationcriteria:eitherawhitevertexoutsideCompisencounteredinSteps5or9,oranoccurrenceofablackvertexwhichispresentontheseedsuperedgeofsomepreviouslyprocessedcomponentComp0isprocessedinStep6.Theformercomponentsarelabeledwhite-terminal-5andwhite-terminal-9respectively,andthelatterarelabeledblack-terminal.First,weintroducethenotionofatracesequence,whichisessentiallyatraceofAlgorithm2.Subsequently,weshowhowtoconvertatracesequencetoacomponent-specictransformationsequenceforamaturecomponentComp.8.1.1TraceSequencesandPropertiesThecoreoftheextendedclosurecomputationinAlgorithm2forCompisStep7whichrepeatedlyperformstraversalsfromavertexoccurrencev0towardsthecurrentCiintreeTi(recallfromLemma19thatCiiscontiguousandthereforecanbevisualizedasasingleshrunkvertexforconvenience).ThetracesequenceTforCompisasequenceofpairs(v0;j0);(v1;j1);:::;(vr1;jr1);(vr;jr)whereeachvhisavertexoccurrenceintreeTjhwhichisprocessedbyAlgorithm2(i.e.,itplaystheroleofv0intheinnerforloopinAlgorithm2).Intuition.WestartwiththevertexoccurrencevrduringwhoseprocessingAlgorithm2encounteredoneoftheterminationcases.Wethenconsidervertexoccurrencevr1whichwhenprocessedcausedvertexvrtobeencounteredforthersttimeinthealgorithm.Thenweconsidervertexoccurrencevr2whichwhenprocessedcausedvertexvr1tobeencounteredforthersttimeinthealgorithm.Thuseachvertex30occurrencevhisthecauseforAlgorithm2encounteringvertexvh+1.Andv0isoneoftheverticeswhosecauseistheinitializationinStep1.Notation.LetChidenotethesetCijustbeforevertexoccurrencevhinthetracesequenceisprocessed.LetChdenotesthesetCatthesameinstant.TraceSequenceDenition.Wenowdenetracesequenceformally.Vertexv0musthaveenteredCbytheinitializationinStep1.For0hr,vertexoccurrencevhmustbethecauseofvertexvh+1,i.e.,vertexoccurrencevhistherstvertexoccurrencetobeprocessed

forwhichvertexvh+1isencounteredineitherS
forwhichvertexvh+1isencounteredineitherStep7orStep9,asmademoreprecisebelow.–Eitheranoccurrenceofvertexvh+1appearsonthepathhfromvertexoccurrencevhtoChjhinTjh(causeviaStep7)(seeFig.8parta),–Or,thispathcontainsanedgedirectedintoavertexwsuchthatnoedgedirectedintowinanytreeTihasbothendpointsinsideChi,andthereexistsanunusededgebetweenvh+1andwthatisdirectedintow(causeviaStep9)(seeFig.8partb).IfCompiswhite-terminal-5thenvertexoccurrencevrintheitem(vr;jr)isthecauseofawhitevertexoutsideCompviaStep5.IfCompiswhite-terminal-9thenvrisoutsideCompandvertexoccurrencevr1intheitem(vr1;jr1)isthecauseofvrviaStep9.Inthiscasetheitem(vr;jr)isreallyadummyitemweaddforcon-venience,i.e.,itdoesnotreectanactualvertexoccurrenceprocessedinAlgorithm2becauseter-minationhappensassoonasvrisencounteredinStep9;however,weimagineadummystepaddedtoAlgorithm2whichprocessesthisvrandstopsassoonasthisprocessingstarts;accordinglywesetjrtoundenedandnoteforlaterreferencethattheitem(vr;undefined)hasbeenintroducedfornotationalconvenienceinthiscase.IfCompisblack-terminalthenvrisblackandthereisanoccurrenceofvrintheseedsuperedgeofapreviouslyprocessedcomponentComp0.Further,whenthevertexoccurrencevrin(vr;jr)isprocessedbyAlgorithm2,thealgorithmstopsinStep6.Notethatinallthreecases,theprocessingofitems(vr1;jr1)doesnotconcludeinterminationwhiletheprocessingof(vr;jr)does.Clearly,thetracesequenceforCompcanbedeterminedintimeboundedbytheclosurecomputationtimebyjustrecordingahistoryofcausesintheextendedclosurealgorithmitself.Wecapturethefollowingsimplepropertiesforfuturereference.Lemma23.Thefollowingholdforanyitem(vh;jh)intheabovetracesequence(notethatincaseswhereh+1=randjrisundened,therelevantclaimsinvolvingTjrwillnotapply).1.For0hr,vertexvh+1isoutsideCh.2.For0hr,allvertexoccurrencesonthepathfromvertexoccurrencevhtoChjhinTjhareinCh+1jh(seeFig.8,bothpartsaandb)andthecorrespondingverticesareinCh+1.3.For0hr,supposevertexoccurrencevhinTjhisthecauseofvertexvh+1viaStep7,andsupposevh+1iswhite.Letw=vh+1denotetherstwhitevertexonthepathfromtheoccurrenceofvertexvh+1inhtoChjh.ThentheoccurrenceofwinTjh+1isinCh+1jh+1.31vh+1vh+1vh+1wxxwvhCh+1jhTjhTjh+1ChjhCh+1jh+1vh+1xwTjh+1Ch+1jh+1vh+1vh+1wxvhCh+1jhChjhCh+11TjhT1bbFigure8:a)ThersttwoguresshowcauseviaStep7.b)ThelastthreeshowcauseviaStep9.Inthese,oncevh+1entersCviaStep9,theprocessingofvh+1inT1willresultinthesecondofthesethreedrawingsbeforevh+1isprocessedinTjh+1asinthethirddrawing.4.For0hr,supposevertexoccurrencevhinTjhisthecauseofvertexvh+1viaStep7,andsupposevh+1isbla

ck.Letwdenoteanywhitevertexonthepathhor
ck.LetwdenoteanywhitevertexonthepathhoranywhitevertexinChjh.ThentheoccurrenceofwinTjh+1isinCh+1jh+1(seeFig.8parta).5.IfComphasaseedsuperedge,bothwhiteendpointsofthissuperedge(exceptv0ifitiswhite)areinC0j0.AndifComphasaseededgecontainingv0thentheotherwhiteendpointofthisedgeisinC0j0.Inanycase,allendpointsofseedsuperedges/seededgesareinC0.6.For0hr,supposevertexoccurrencevhinTjhisthecauseofvertexvh+1viaStep9.Letwdenotethewhiteendpointoftherelevantunusededge.ThentheoccurrenceofwinTjh+1isinCh+1jh+1andbothendpointsoftheaboveunusededgeareinCh+1(seeFig.8partb).7.For0hr,supposevertexoccurrencevhinTjhisthecauseofvertexvh+1viaStep9,andsupposevh+1isblack.Unlessthevertexoccurrencevh+1representedinthepair(vh+1;jh+1)isaleaf,allleafoccurrencesofvertexvh+1inT1(andthereexistsatleastonesuchleafbyLemma2)andallvertexoccurrencesontheirrespectivepartialsuperedges(thewhiteendpointsinclusive)areinCh+11;furtherthesewhiteendpointsarethemselvesinCh+1jh+1intreeTjh+1(seeFig.8partb).8.Supposevertexv0isablackvertexonaseededge.Unlessthevertexoccurrencev0representedinthepair(v0;j0)isaleafinT1(i.e.,j0=1),allleafoccurrencesofvertexv0inT1(andthereexistsatleastonesuchleafbyLemma2)andallvertexoccurrencesontheirrespectivepartialsuperedges(thewhiteendpointsinclusive)areinC01;furtherthesewhiteendpointsarethemselvesinC0j0intreeTj0.Proof.Part1followsfromthefactthatvhcausesvh+1.Part2followsfromStep7ofAlgorithm2.Part3followsfromtheorderingofentryintoCinStep7andthecorrespondingorderofvertexprocessinginStep4.Part4followsfromtheorderofvertexprocessinginStep4,i.e.,whitesareprocessedbeforeblacks.ConsiderPart5:Ifv0isawhiteendpointofaseedsuperedge/edge,thenpart5followsfromtheinitializationinSteps1and2(notethatv0cannotbethevertexufromStep2);andifv0isblack,thenpart5followsfromtheinitializationinStep1andtheorderofvertexprocessinginStep4,i.e.,whitesareprocessedbeforeblacks.Part6stemsfromthefactthatwentersCbeforevh+1does,theorderofvertexprocessinginStep4(i.e.,whitesareprocessedinorderofentryintoCandbeforetheblacks),andthefactthatvh+1canbeusedinStep4onlyafterenteringC.TherstclaimsinParts7and8followfromtheorderingintheforloop32vh+1vhehCjhCjhehvhCjhCjhvhvhvhvhehCjhCjhehvhCjhCjhvhvhvhehehehehvhvhvhvhCjhCjhCjhCjhvhvhvh+1vh+1vh+1vh+1vh+1Figure9:Swap,Mate-Swap,Join-Swap,Swap+Incidence,Mate-Swap+Incidence,Join-Swap+IncidenceafterStep4(i.e,leavesrst)alongwithStep7whereallvertexoccurrencesonthesepartialsuperedgeswillbeaddedtoC1beforethevertexoccurrencevh+1isprocessedinTjh+1.ThelastclaimsinParts7and8followfromtheorderofver

texprocessinginStep4,i.e.,whitesareproce
texprocessinginStep4,i.e.,whitesareprocessedbeforeblacks.8.1.2ConvertingtheTraceSequencetoaComponent-specicTransformationSequenceConsiderthetracesequenceTforCompasabove.ThegoalofthissectionistoconvertTtoacomponent-specictransformationsequence.WedothisbyprocessingtheitemsinTinorder,butskippingtheverylastitem(vr;jr).ThatitemwillbehandledinPhase2.Foreachitem(vh;jh),0hr,wewilldothefollowing:givenafreesuperedge/edgeehcontainingvh,wewillshowhowonetransformationoperationcanbeperformedusingehtofreeanothersuperedge/edgeeh+1containingvh+1.ThealgorithmforthisisshowninAlgorithm3,andunfortunately,thereareseveralcases,witheachcaseperformingoneofthetransformationoperationslistedinSection5.3.ThemaincasesareshowninFig.9.CorrectnessOverview.NotethatprovingcorrectnessofAlgorithm3requiresanelaboratecaseanalysis.Wetakeonecaseforillustration.Supposevhiswhite,ehisasuperedge(withendpointvh)andvh+1iscausedviaStep7(seetherstdrawinginFig.9).ThenStep1doesnotapply.Step2appliesandprescribesaswap.Foravalidswap,weneedtoshowthata)ehhasoneendpointinChjh,andb)thereisasuperedgecontainingvh+1onthepathfromvertexoccurrencevhtoChjhinThjh.Wewillassumethattherstpartholdsinductively,usingwhatwecallInvariantP1below.Forthesecondpart,notethatbythedenitionofatracesequence,suchasuperedgeindeedexistedbeforeanytransformationsweremade.Whyisitstillinexistence?WewillassumeinductivelythattheseprevioustransformationsleavetheportionofTjhoutsideChjhuntouched,usingwhatwecallInvariantP2below.WewillthenshowthatInvariantsP1andP2holdthroughiterationsoftheforloop.WorkingwithEdges.Anothercomplicationtonoteisthatehcouldbeanedgeorasuperedge.Supposeitisanedgeandnotasuperedge.IfvertexoccurrencevhinTjhisaleaf(sojh=1)thenleavingehasisisne33Algorithm3Convertingatracesequencetoacomponent-specictransformationsequence.0.e0 Seedsuperedge/edgecontainingv0.foreachitem(vh;jh),0hrinorderdoifehisanedge,vhisblack,andvertexoccurrencevhinTjhisnotaleafoccurrencethen1.eh JOINehwiththepartialsuperedgeinT1incidentonsomeleafoccurrenceofvh.endififvhcausesvh+1viaStep7thent Superedgecontainingvh+1onthepathfromvertexoccurrencevhtoChjhinTjh.elseifvhcausesvh+1viaStep9involvingwhitevertexwthent EdgedirectedintowonthepathfromvertexoccurrencevhtoChjhinTjh.endififvhiswhitethen2.SWAPehfortinTjh.elseifvhisblackandehisanedgethen3.JOIN-SWAPehfortinTjh=T1.elseifvhisblackandehisasuperedgethen4.MATE-SWAPehfortinTjh.endififvhcausesvh+1viaStep7theneh+1 telseifvhcausesvh+1viaStep9involvingwhitevertexwthen5.eh+1 INCIDENCEtfortheunusededgedirectedintowfromvh

+1.endifendforiferisanedge,vrisblack,and
+1.endifendforiferisanedge,vrisblack,andvertexoccurrencevrisnotaleafoccurrencethen6.er JOINerwiththepartialsuperedgeinT1incidentonsomeleafoccurrenceofvr.endifbecauseitcanperformajoin-swapoperationwiththepartialsuperedgeassociatedwithaboveoccurrenceofvh.However,ifvertexoccurrencevhinTjhisnotaleaf(sojh=1)thenwewouldliketoconvertehtoasuperedgesoitcanperformswapsormate-swaps;henceSteps1and6inAlgorithm3.InvariantP1.ehsatisesthefollowingpropertiesforallh,0hr.1.IfvertexvhiswhitethenehisasuperedgeforwhichoneendpointhasanoccurrenceChjhandvhistheotherendpoint.Theonespecialcaseiswhenh=randCompiswhite-terminal-9(seethetracesequencedenitionforthisspecialcase),inwhichcasejrisundened;inthatcase,erisasuperedgeforwhichoneendpointisinCrandvristheotherendpoint.2.Ifvertexvhisblackthentherearetwocases:2.1.EitherehisasuperedgecontaininganoccurrenceofvhandwithbothwhiteendpointshavingoccurrencesinChjh(andthereforebothendpointsareinChaswell).2.2.Or,ehisanunusededgedirectedfromvertexvhtosomewhitevertexwwithanoccurrenceinChjh(vertexwisthereforeinChaswell);thiscaseholdsonlywhenvh1causesvhviaStep9,orifh=0andehisaseededge.34InvariantP2.ConsidertransformationsmadetofreeehinAlgorithm3,forallh,0hr.AllchangesmadetotreeTi,1ik+1,arelocalizedwithinChi,whichstayscontiguousevenafterthesechanges.Ifehisanedgewithblackendpointvh,thenleafoccurrencesofvh(inT1)areintact.TheonlyunusededgesaffectedbythisprocessarethosewithbothendpointsinCh.SeedsuperedgesforcomponentsotherthanCompareuntouched.Lemma24.InvariantsP1andP2holdatthebeginningofAlgorithm3,attheendofeachiterationoftheforloop,andattheveryend.Proof.Weshowthisbyinduction.TheBaseCase.ConsiderStep0.e0isdenedbyStep0andv0hastobeine0bythedenitionofatracesequence.InvariantP1followsfromLemma23,part5.InvariantP2clearlyholdsbecausenochangesaremadetothetrees,andtheonlyunusededgeaffected,ifany,isaseededgewithbothendpointsinC0(Lemma23,part5).TheInductiveStep.AssumingInvariantsP1andP2holdatthebeginningofiterationh,0hr.Consideriterationh.WeshowthattheinvariantsholdattheendofStep1,attheendofwhicheverofSteps2,3,4or2+5,3+5,4+5isperformed,andattheendofStep6ifh=r1.ConsiderStep1whichconvertsanedgeehtoasuperedgeunderthementionedconditions.ByInvariantP1,ehisunused.Thenewehisasuperedgeinthiscase.Thejoinoperationisvalid:vhhadaleafoccurrenceinT1tobeginwith(Lemma2),andthisoccurrenceofvhisstillinT1(obviousforh=0becausenotransformationshavebeenmade;andbyInvariantP2forh1).InvariantP1ismaintained:thenewehclearlycontainsvh,andbothendpointsofehareinChjh(Lemma23,par

ts7and8).InvariantP2ismaintained:therele
ts7and8).InvariantP2ismaintained:therelevantportionsofT1modiedareinCh1(Lemma23,parts7and8),whichisstillcontiguous.ConsiderStep2.eh+1isasuperedgeinthiscase.Theswapoperationisvalid:ehhasendpointsvhandinChjh(Invariant1),thepathfromvertexoccurrencevhtoChjhinTjhisuntouchedbyprevioustransformations(Invariant2),andvertexvh+1isontheabovepath(bythedenitionofcauseviaStep7).InvariantP1ismaintained:eh+1clearlycontainsvh+1,andallendpointsofeh+1(otherthanpossiblyvh+1)areinsideCh+1jh+1(Lemma23,parts3and4).InvariantP2ismaintained:changesmadetoTjharerestrictedtothepathbetweenvhandChjh,whichlieswithinCh+1jh(Lemma23,part2);thesechangesclearlymaintaincontiguityofCh+1jhaswell.ConsiderStep3.eh+1isasuperedgeinthiscase.BytheconditionforStep1,thevertexoccurrencevhisaleafoccurrence,andthereforeinT1.Thereforejh=1.Thejoin-swapoperationisvalid:thepathfromleafoccurrencevhtoChjhinTjhisuntouchedbyprevioustransformations(Invariant2),andvertexvh+1isontheabovepath(bythedenitionofcauseviaStep7).InvariantP1ismaintained:eh+1clearlycontainsvh+1,andallendpointsofeh+1(otherthanpossiblyvh+1)areinsideCh+1jh+1(Lemma23,parts3and4).InvariantP2ismaintained:changesmadetoTjharerestrictedtothepathbetweenvhandChjh,whichlieswithinCh+1jh(Lemma23,part2);thesechangesclearlymaintaincontiguityofCh+1jhaswell.ConsiderStep4.eh+1isasuperedgeinthiscase.Themate-swapoperationisvalid:ehcontainsblackvhandhasbothendpointsinChjh(Invariant1),thepathfromvertexoccurrencevhtoChjhinTjhisuntouchedbyprevioustransformations(Invariant2),andvertexvh+1isontheabovepath(bythedenitionofcause35viaStep7).InvariantP1ismaintained:eh+1clearlycontainsvh+1,andallendpointsofeh+1(otherthanpossiblyvh+1)areinsideCh+1jh+1(Lemma23,parts3and4).InvariantP2ismaintained:changesmadetoTjharerestrictedtothepathbetweenvhandChjh,whichlieswithinCh+1jh(Lemma23,part2);thesechangesclearlymaintaincontiguityofCh+1jhaswell.ConsiderSteps2+5.eh+1couldbeasuperedgeoranedgedependinguponwhetherornotvh+1iswhite.TheswapoperationisvalidasinStep2.Theincidenceoperationisvalid:theunusededgeeh+1isnotaffectedbyprevioustransformations(InvariantP2andLemma23,part1).InvariantP1ismaintained:eh+1isdirectedintoawhitevertexwwhoseoccurrenceinTjh+1isinCh+1jh+1(Lemma23,part6).TheonetechnicalspecialcaseforInvariantP1insubcase1iswhenh+1=randjrisundenedinthewhite-terminal-9case;inthiscase,theendpointwofeh+1isinCh+1(Lemma23,part2).InvariantP2ismaintained:changesmadetoTjharerestrictedtothepathbetweenvhandChjh,whichlieswithinCh+1jh(Lemma23,part2),thesechangesclearlymaintaincontiguityofCh+1jhaswe

ll,ifeh+1isanedgethenleafoccurrencesofvh
ll,ifeh+1isanedgethenleafoccurrencesofvh+1(inT1)areintact(Lemma23,part1),andeh+1hasbothendpointsinCh+1(Lemma23,part6).ThevalidityproofsforSteps3+5and4+5areeasilyseentobecombinationsoftheproofsforSteps3and4,respectively,alongwiththeproofforSteps2+5.TheproofforStep9isidenticaltothatforStep1.Thelemmafollows.Corollary1willbethestartingpointforPhase2inSection8.3.Corollary1.ForanymaturecomponentComp,ersatisesthefollowingproperties.1.IfvertexvriswhitethenerisasuperedgeforwhichoneendpointhasanoccurrenceinCrjr=Cjrandvristheotherendpoint.Forthewhite-terminal-9case,oneendpointisinCandtheotherisvrwhichisoutsideComp.2.Ifvertexvrisblackthentherearetwocases.2.1.Eithererisasuperedgecontaininganoccurrenceofvrandwithbothendpointshavingoccur-rencesinCrjr=Cjr.2.2.Or,onlyintheeventthatjr=1andthevertexoccurrencevrreferredtointheitem(vr;jr)isaleafoccurrenceinT1,erisanunusededgedirectedfromvertexvrtosomewhitevertexwwithanoccurrenceinCrjr=Cjr.3.AllchangesmadetotreeTi,1ik+1,tofreeerarelocalizedwithinCri,whichstayscontiguousevenafterthesechanges.4.TheonlyunusededgesaffectedarethosewithbothendpointsinCr.5.SeedsuperedgesforcomponentsotherthanCompareunaffected.Proof.NotethatCrjr=CjrandCr=Cbecausenochangeshappentothesesetswhenthelastitem(vr;jr)isprocessed.TheclaimsfollowfromLemma24,InvariantsP1andP2,andStep6ofAlgorithm3(thelatterforitem2.2above).Corollary2.Phase1canbeperformedindependentlyforallmaturecomponents.ThetotaltimetakenforCompisboundedbythetimeforextendedclosurecomputationwhichaddsuptoO(nk)overallcompo-nents.36Proof.ByLemma22,foragiveni,1ik+1,Cri'sforthevariouscomponentsaredisjoint.AlsonotethattheCr'saredisjointaswellwhenrestrictedtowhitevertices.Theindependenceclaimfollowsfromparts3,4and5ofCorollary1.Thetimespentessentiallymimicsthetracesequencewhichisasubsetofthetimespentinextendedclosurecomputation.8.2Phase1:Component-specicTransformationSequenceforPrematureComponentCompThechallengewithprematurecomponentsisthattheaboveprocedureforobtainingacomponent-specictransformationsequencemaynotyieldasuperedgewhichwillconnectComptoanothercomponentorevenasuperedgewhichcanbemadetoconnecttoanothercomponentwithO(1)moretransformations.OneoptionistonotstopbutcontinuewithAlgorithm2untiloneoftheterminationconditionsformaturityapplies(soCompterminatesasmature).However,Lemma22getsviolatedthen.Sostoppingprematurelyorcontinuingtomaturitybothposeproblems.OursolutioninthiscaseistoobservethatwecaneffectivelycombinethetracesequencesofCompwiththatofComp0(whereCComp0icontainedthevertexoccurrencecaus

ingprematureterminationofAlgorithm2forCo
ingprematureterminationofAlgorithm2forComp)toobtainatracesequencethatterminateswiththesameconditionsthatthetracesequenceforamaturecomponentwouldterminatewith.WewillneedtothenproveLemma23forthistracesequenceinordertoclaimthattheconstructionoftransformationsequencesinSection8.1.2continuestowork.Tothiseffect,wedeviseanextensionofAlgorithm2describedinAlgorithm4below.ThelatteralgorithmkicksinwhenAlgorithm2terminatesprematurelyanditstartsoffexactlywhereAlgorithm2leftoff.ThegoalofAlgorithm4isthesameasthatofAlgorithm2withthefollowingnotabledifference:Algorithm4willconsideronlythoseblackvertexoccurrencesinStep5whichareinCComp0jforthetreeTjbeingprocessed.FortreeT1,wewillprocessallblackleafoccurrencesaswellinaddition.AndSteps8and9arenotneededanylongerWewillshowthatthisresultingcomputationwillindeedterminateinmaturity.TheresultingtracesequencewillcompriseaprexfromAlgorithm2andasufxfromAlgorithm4;andanyitem(vh;jh)inthelatterwillhavethepropertythatvhiseitherwhite,ablackleaf,oritisablackvertexoccurrenceinCComp0jh.WewillthenshowthatthesetracesequencesindeedsatisfyLemma23.Lemma22isstillviolatedthough;butthatiseasilyxedbykeepingoneofComp;Comp0awayfromfurtherprocessing,sonotransformationsequencesareobtainedforthatcomponent;wewillstillbeleftwithaconstantfractionofthecomponentsafterwediscardsuchcomponents.Algorithm.WestartbytakingpairsComp;Comp0asaboveanddroppingaconstantfractionofcompo-nentsfromallfutureprocessingsoatmostoneitemfromeachpairsurvives.ForallremainingitemsCompwerunAlgorithm4startingwiththestatesofCandCi'sastheywerewhenAlgorithm2forCompter-minated,andstartingbyprocessingpreciselythesamevertexoccurrencethatcausedtheabovetermination(thoughthisinitializationhasnotbeenexplicitlyspelledoutinAlgorithm4).Algorithm4thenevolvesthesesetsfurther.NotethekeychangesinAlgorithm4:Steps8and9aregoneaswellastheconditionforprematuretermination;butmostimportantly,thehandlingofblacksintheinnerforloopisdifferent:onlyblacksinCwitheitheraleafoccurrenceofanoccurrenceinCComp0iareprocessed.Lemma25showsthatthealgorithmdoesindeedterminateresultinginamaturecomponent.Lemma25.Algorithm4foraprematurecomponentCompterminates;thetimetakenisO(nk)overallcomponents.Proof.SinceCompispremature,Algorithm2providesablackvertexb,someoccurrenceofwhichispresentinC,andanoccurrencebr+1ofwhichisalsopresentinCComp0jr+1forsometreeTjr+1(theseeminglyunnecessarysubscriptsr+1;jr+1areforfutureconvenience).37Algorithm4SequeltoExtendedClosureComputationforPrematureComponentComprepeatforeachtreeTi;1ik+1inorderdo3.LetXcompr

isewhiteverticesinCoutsideCi,andblackver
isewhiteverticesinCoutsideCi,andblackverticesinCwhichhavevertexoccurrencesoutsideCithatareeitherleafoccurrencesorthatareinsideCComp0i.4.OrderverticesinXsowhitescomerst,blackslater,andeachsetisfurthersortedinincreasingtimeorderofentryintoC.foreachvertexv2Xinorderandeveryoccurrencev0ofvinTi(ifvisblackthenprovidedv0isaleaforv0isinCComp0i;occurrencesareconsideredinnarbitraryorderexceptinT1whereleafoccurrences,ifany,areconsideredrst)do5.IfthepathbetweenCiandv0containsawhitevertexoutsideCompterminatethealgorithm.6.IfvisblackandhasanoccurrenceintheseedsuperedgeforsomecomponentComp0thenterminatethealgorithm.7.AddallwhiteandblackvertexoccurrencesbetweenCiandv0toCiinorderofincreasingdistancefromCiandaddthecorrespondingverticestoCinthesameorder.endforendforuntileternityNowconsiderAlgorithm2forcomponentComp0andthetracesequence(forcomponentComp0)whichleadstovertexbr+1enteringCComp0.Letthissequencebe(b0;j0);(b1;j1);:::;(br;jr),whereb0entersCComp0byinitialization,andvertexoccurrencebhintreeTjhcausesvertexbh+1for0hr,(seethedenitionofcauseinthedescriptionofatracesequenceinSection8.1.1).Inthissequence,considerthelargestvalueofl,0lr,forwhichvertexoccurrenceblintreeTjlcausesvertexbl+1viaStep9ofAlgorithm2;andifnosuchlexistssetl=1.AndletzdenotethewhitevertexwithwhichAlgorithm2initializedCComp0i's.Then,forvertexoccurrencesbh,l+1hr,thereexistsanoccurrenceofbh+1onthepathtovertexzinTjh,andthisentirepathisinCComp0jh.NowswitchingtoAlgorithm4onComp.Sincebr+12CatthebeginningofAlgorithm4,itfollowsthatverticesbr+1;br;:::;bl+1willeventuallyenterCinAlgorithm4(unlessAlgorithm4terminatesbeforethat,inwhichcasethelemmaholdsanyway).IfanyoftheseverticesiswhitethenAlgorithm4terminatesinStep7,becausethesewhitesbelongtoComp0.Soassumealltheseverticesareblack.Therearetwocasesnow.Ifl=1andComp0hadaseedsuperedge,thenthatsuperedgecontainsbl+1=b0andAlgorithm4terminatesinStep6.Soconsiderthecasethatl�=0,orl=1andComp0hasnoseedsuperedge(inwhichcasebl+1=b0comesfromaseededgeforComp).Ineithercase,weshowbelowthataleafoccurrenceofbl+1inT1anditsnearestwhiteancestorbothbelongtoCComp01,whichwillcauseterminationinStep5whenbl+1isprocessedinT1.Toseethis,switchbacktoAlgorithm2onComp0andrecalltheleafrstorderforT1intheinnerforloop.Oncebl+1entersCComp0(whichitdoesbecauseanoccurrenceofbl+1isinCComp0jl+1,evenifl=r),itwillrstbeprocessedintreeT1.Iftherstleafoccurrenceofbl+1processedinT1succeedsinitstraversaltothethenCComp01,thenwearedone.Otherwise,ifthistraversalfails,thenanoccurrenceofbl+1cannotbeinCComp0ifora

nytreeTi,whichisacontradiction.Itremains
nytreeTi,whichisacontradiction.Itremainstodeterminethetimecomplexity.ThemainchangefromAlgorithm2isinStep3anditsufcestoshowhowthisstepcanbeperformedintimeO(jXj).ThisisdoneinamanneranalogoustothequeuesinLemma20;weneedtoaccessqueuesinthenexttreeTiwhichhasanoccurrenceoftherelevant38blackwithinCComp0i.Thiscanbeaccomplishedwithappropriatebook-keeping.Thelemmafollows.Tracesequencescanbedenedasbefore.WeshowbelowthatLemma23holdsforthesetracesequences.Lemma26.Lemma23holdsfortracesequencesofprematurecomponentsCompobtainedbyrunningAlgorithm4afterAlgorithm2.Proof.LetthetracesequenceforCompbe(v0;j0);(v1;j1);:::;(vr1;jr1);(vr;jr);:::;(vt1;jt1);(vt;jt)where(vr1;jr1)isthelastitemthatcomesfromAlgorithm2andallsubsequentitemsstartingwith(vr;jr)comefromAlgorithm4.ByLemma23,parts1,2,3,4,6and7inLemma23holdforh,0hr1(weuser1andnotrherebecausethecaseofh=r1canbeimpactedbytheprocessingofbothvr1andvr,whicharedonebydifferentalgorithms),andparts5and8holdforh=0providedr&#x-3.2;≦0.Soitremainstoshowparts1,2,3,4,6and7forh,r1ht,andparts5and8forh=0intheeventthatr=0.ThesameproofsasbeforeareeasilyseentoholdinParts1,2,3forallh,r1ht.ThesameistrueforPart5inthecaseh=r=0.Parts6and7donotapplytor1htbecauseStep9ismissinginAlgorithm4;sothesepartsneedtobeshownonlyforh=r1.Theproofofpart6forh=r1isthesameasbeforeaswell.Sothatleavesonlyparts7and8tobeshownforcasesh=r1andh=r=0,respectively.Thesameproofbelowhandlesbothoftheseparts.Notethatthesepartsapplywhenvrisblack,causedviaStep9orviaseededgeinitialization,andthevertexoccurrencevrinTjrisnotaleafoccurrence.AfterAlgorithm2addsvertexvrtoC,itwillprocessallleafoccurrencesofvrinT1beforeprocessingvertexoccurrencevrinTjr.IfAlgorithm2terminatesbeforethishappensthensinceAlgorithm4continueswhereAlgorithm2leftoffandsinceAlgorithm4isalsoallowedtoprocessleafblackoccurrencesandprocessesthoserstoverotheroccurrencesofvrinT1,allleafoccurrencesofvrinT1willindeedbeprocessedbeforeprocessingvertexoccurrencevrinTjr.IfAlgorithm4alsoterminatesbeforethishappensthenvertexoccurrencevrinTjrwillneverbeprocessed,acontradiction.Therstclaiminparts7and8follow.Thesecondclaiminparts7and8followsincewhitesarestillprocessedbeforeblacksbytheorderinginStep4.Thelemmafollows.Lemma27.Lemma22continuestoholdafterAlgorithm4hasrunonallsurvivingprematurecomponents.Proof.SupposesetsCComp0iandCComp00iarenotdisjoint,i.e.,theyshareablackvertexoccurrencebincommon.Thenonlytwocasesarepossible.EitherbisaleaforAlgorithm2foroneofthesecomponents,sayComp0,terminatedprematurelybecauseitprocessedabl

ackvertexoccurrenceinsideCComp00jforsome
ackvertexoccurrenceinsideCComp00jforsometreeTj.Inthelattercase,onlyoneofthesetwocomponentssurvives.Soconsidertheformercase.ByvirtueofStep5inbothalgorithms,Algorithm2andAlgorithm4,theleafoccurrencebwillenterbothCComp01andCComp001onlyifthethewhiteendpointofthepartialsuperedgeincidentonbisinboththesecomponents,acontradiction.Thelemmafollows.Tocompletethedescription,notethatLemma19iseasilyseentohold.SinceLemmas22,19and23allhold,themachineryinSection8.1.2appliesaswell.Wearethusleftwithaconstantfractionoftheoriginalsetofcomponents,allofwhicharemature,andCorollaries1and2applytothese.39onthisbranchCjrvrwhiteoutsideCompLRCjrvrLRwhiteoutsideCompAllwhitesinCompFigure10:Twocasesforthedenitionofalaststretch;theformerisc-biasedandthelatterv-biased.8.3Phase2:CompletingtheTransformationSequenceThissectionconsidersallsurvivingcomponentswhichcompriseaconstantfractionoftheoriginalsetofcomponents.Tocontrolinteractionsbetweenthesecomponents,wewillneedtofurtherpruneawaythissurvivingsetofcomponentsinO(nk)timetoretainafurtherconstantfraction,asdescribedinSection8.3.1.Phase1willbeperformedonlyafterthispruningstepandonlyonthesurvivingcomponents,resultinginacomponent-specictransformationsequenceforeachofthesecomponentswiththepropertieslaidoutinCorollary1.NotethatbyCorollary2,allofthesePhase1computationscanproceedindependently.ThegoalnextistoperformfurthertransformationssothenumberofconnectedcomponentsinTk+1reducesbyaconstantfraction,asshowninSection8.3.2.Infact,eachsurvivingcomponentwillbeconnectedtosomeothercomponentasaresultofthetransformationsperformedinSection8.3.2.Thiswilltaketimeproportionaltothenumberofcomponentsinplay.8.3.1PruningComponentsWeneedthefollowingdenitions.Recall(vr;jr)isthelastiteminthetracesequenceforComp.Asusual,weuseexplicitsuperscriptstodenotecomponentsotherthanComp(forinstancevComp0risvertexoccurrencevrforComp0).LastStretches.Forawhite-terminal-5component,denethelaststretchLRasfollows.TraverseupfromvrandfromCjrtowardstheirleastcommonancestor,stoppingeachtraversalwhentherstwhitevertexoutsideCompisencountered(whichwillhappenbythedenitionofawhite-terminal-5component;alsorecallnotransformationshavebeenperformedyet).Ifbothtraversalsencountersuchwhiteverticesthenpickthetraversalthatstartswithavertexwithlowerpostordernumber,otherwisepicktheonlytraversalthatencountersawhitevertexoutsideComp;thestretchofvertexoccurrencestraversedbythistraversal,bothendpointsinclusive,isdenotedbyLR.SeeFig.10.NotethatLRterminatesonawhitevertexoutsideComp.WesaythatLR(andcomponentCom

paswell)isv-biasedifthecorrespondingtrav
paswell)isv-biasedifthecorrespondingtraversalbeganatvr,andc-biasedotherwise.Notethatcomputingtheselaststretchesrequiresknowingtheleastcommonancestor,whichcanbedeterminedinO(1)timeafterlineartimeprecomputationontreesT1;:::;Tk+1.ThegoalsofpruningarelistedinLemmas28,29,30,31and32.Weusethefollowingpruningruleswhichstillretainaconstantfractionofthecomponents;thetimetakenislinearinthenumberofcomponents.PruningRule1.WesaythattwocomponentsComp;Comp0clashifeitherthelaststretchofCompterminatesonawhitevertexinComp0,orthevertexoccurrencevrforcomponentComp(fromthelast40TerminalWhitevComp1rvComp2rvComp3rFigure11:Overlappinglaststretchesarewithinasuperedge.iteminitstracesequence)ispartofasuperedgewithanendpointinComp0,orvertexoccurrencevrispartofCComp0jrintreeTjr,orCompisblack-terminalandComp0isthecomponentwhoseseedsuperedgehasanoccurrenceofvrcausingtheterminationofextendedclosurecomputationonComp.Sincethenumberofclashingpairsislinearinthenumberofcomponents,wecanndaconstantfractionofclash-freecomponentsintimelinearinthenumberofcomponents.PruningRule2.Wepartitionsurvivingwhite-terminal-5componentsintotwogroups,thosewhichhavev-biasedlaststretchesandthosewhichhavec-biasedlaststretches;weretainonlycomponentsinthelargergroup.PruningRule3.Ifthelaststretchesformultiplecomponentsterminateatthesamewhitevertexoccurrence,wediscardtheonewiththelongeststretch.Lemma28.Forallwhite-terminal-5componentsCompwithlaststretchLRintree,sayTi,edgesinLRareoutsideCComp0i,asistheterminalwhitevertexofLR,foranycomponentComp0(inclusiveofComp).Further,theterminalProof.Thelemmafollowsfrompruningrule1andthedenitionofalaststretch.Lemma29.Foranypairofwhite-terminal-5components,iftheirrespectivelaststretcheshaveanedgeincommonthenbothstretchesmustbestrictlycontainedwithinonesuperedgeandbothmusthavethesameterminalwhitevertex(seeFig.11).Proof.Followsfrompruningrule1,pruningrule3,andthefactthattwostretchessharinganedgecanhaveatmostonewhitevertexincommon.Lemma30.Eitherallwhite-terminal-5componentsarev-biasedorallarec-biased.Proof.Followsfrompruningrule2.Lemma31.Vertexoccurrencevrforawhite-terminal-5componentCompisnotpartofthelaststretchforanyotherwhite-terminal-5componentunlessallsurvivingcomponentsarev-biased.41Proof.ByLemma30,itsufcestoconsiderthecasewhenallwhite-terminal-5componentsarec-biased.Supposeforacontradictionthatvrispartofthelaststretchofwhite-terminal-5componentComp0.ThenthesuperedgecontainingvrmusthaveanendpointinComp0.Thelemmathenfollowsbypruningrule1.Lemma32.Considerawhite-terminal-5compone

ntCompthatisv-biased.Ifthepost-ordernumb
ntCompthatisv-biased.Ifthepost-ordernumberofCjrislessthanthatofvrinTjr,thenthelaststretchforanyotherwhite-terminal-5componentComp0cannotterminateonawhitevertexonthepathfromCjrtotheleastcommonancestorofCjr;vrinTjr.Proof.Bythedenitionofalaststretch,allwhiteverticesonthepathareinComp.Thelemmanowfollowsfrompruningstep1.8.3.2CompletingtheTransformationSequenceWedothisintwosteps.Therststepconsidersasubsetofthewhite-terminal-5componentsandperformstransformationsonthese.Thesecondstepconsidersallcomponentstocompletetheprocedure.Attheend,eachcomponentwillbeconnectedtosomeothercomponentasaresultofthetransformationsperformedhere.Thetimetakenisproportionaltothenumberofcomponents.Step1.ByLemma29,weformequivalenceclassesofwhite-terminal-5components,whereanon-singletonequivalenceclassiscontainedwithinthesamesuperedge.Wepickarepresentativefromeachclass,namelytheonewiththelongestlaststretch;wethenprocessallclassrepresentativestogetherinthisstep.Notethatthelaststretchesoftheserepresentativesarecompletelyedge-disjointbythisconstructionandbyLemma29.ConsideraclassrepresentativecomponentCompandletedenotethesuperedge/edgereleasedforCompinPhase1asperCorollary1.TheadditionaltransformationstobeperformedforCompareil-lustratedinFig.12,dependinguponwhichofthecases1,2.1,2.2fromCorollary1holdsfore.Bythedenitionofalaststretch,theresultingsuperedgefreedineachcaseconnectsComptoanothercomponent.Thefollowinglemmashowsthattheseadditionaltransformationsareindeedvalid,inspiteoftransforma-tionsperformedinPhase1andinspiteofotherclassrepresentativecomponentsprocessedbeforeCompinStep1.Thetimetakenwillbelinearinthenumberofcomponents.Lemma33.AfterPhase1andafterallpreviousrepresentativecomponentshavebeenprocessedinStep1,LRforCompisstillintactandispresentonthepathfromvertexoccurrencevrtoCjrinTjr.Proof.ByLemma19,Corollary1andLemma28,LRisintactafterPhase1andstillappearsonthepathfromvrtoCjrinTjr.LRisstillintactafterallpreviousrepresentativecomponentshavebeenprocessedinStep1abovebecausethelaststretchesofallrepresentativecomponentschosenhereareedge-disjointandbecauseofLemma31andLemma28.ItremainstoshowthatLRisstillonthepathfromvrtoCjrinTjrafterallpreviousrepresentativecomponentshavebeenprocessedinStep1above.Toseethis,considerprocessingrepresentativecomponentsintheorderdenedbelow(clearly,compo-nentswithlaststretchesontreesotherthanTjrareuninteresting).ForanyparticularcomponentComp0,letxdenotetheterminalwhitevertexofLRComp0andletydenoteitschildsuchthatLRComp0hastheedge(x;y).Ordercomponentsinincreasingpost-orde

rnumberoftheircorrespondingy's.Thedescri
rnumberoftheircorrespondingy's.ThedescriptionbelowassumesthatComp0istherstcomponentinthisorder(seeFig.13).WeshowinthenextparagraphthatthesubtreerootedatycontainsneitherCComp00jrnorvComp00r,foranycomponentComp00=Comp0.Itfollowsthatwecanremovetheedge(x;y)andthewholesubtreeofTjrrootedatytogetasmallertreewithoutaffectingtheprocessingforanyofthecomponentsotherthan42TjrvrLRvrvrLRvrCjrCjrvrvrCjrCjrCjrLRCjrvrvrT1erererTjrFigure12:AdditionaltransformationsforComp:Swap,Mate-SwapandJoin-Swap,basedonwhichofcases1,2.1and2.2holdforerinCorollary1.vComp0ryLRComp0postorderHigherNoLastStretcheshereLowerPostorderxCComp00jrTjrvComp00rFigure13:LRComp0,xandy43Comp0.WeprocessthesecomponentsrecursivelytogetanewtreeT0jr.Nowweputbackedge(x;y)andthesubtreerootedaty;clearlyLRComp0isstillonthepathfromvComp0rtoCComp0jrinthisresultingtree,asrequired.ItremainstoshowthatthesubtreerootedatycontainsneitherCComp00jrnorvComp00r,forsomecomponentComp00=Comp0.Withoutlossofgenerality,assumeallrepresentativecomponentsarev-biased(seeLemma30;asimilarargumentholdswhenallthesecomponentsarec-biased).ThenvComp00rcannotbeinthesubtreerootedaty,otherwiseLRComp00ispresentcompletelyinthissubtreeaswellandthenComp00wouldprecedeComp0intheorderestablishedabove.SosupposeforacontradictionthatCComp00jrisinthissubtree.Therearetwocasesbasedonthepost-ordernumberofvComp00r.Ifthisnumberislessthanthatofx,theneitherComp00mustprecedeComp0intheabovespeciedorderorLRComp00mustextendbeyondtheleastcommonancestorofvComp00r;CComp00jr,bothofwhichpresentcontradictions.Soconsiderthecasethatthepost-ordernumberofvComp00risgreaterthanthatofx,andthereforethatofCComp00iaswell.vComp00rcannotbeanancestorofy,otherwiseComp00isnotv-biased.Bythedenitionofalaststretch,itfollowsthatallwhiteverticesonthepathfromCComp00jrtotheleastcommonancestorofvComp00r;CComp00jrmustbeinComp00.Inparticular,xisinComp00,whichcontradictsLemma32.Thiscompletestheproofofthelemma.Step2.Nowconsideranyequivalenceclassofwhite-terminal-5components,andallnon-representativecomponentsinthisclass.Lete1;:::;ehdenotetheirrespectiveedges/superedgesasdenedinCorollary1,andleta1;:::;ahdenotethevertexoccurrencesinvolvedinthelastitemsintheirrespectivetracesequences.Notethateacheihasawhiteendpointinitsrespectivecomponent.ByLemma29,a1;:::;ahareallblack.AndbyCorollary1,eihasaninstanceofai,foralli,1ih.Alsodenee0tobethefreesuperedgeobtainedfortherepresentativecomponentofthisclassinStep1above,whichconnectsthatcomponenttoanother.Notethatbythedenitionofarepresentative,e0hasaninstance

ofeachofa1;:::;ah.Alsonotethatsomeofthee
ofeachofa1;:::;ah.Alsonotethatsomeoftheei's(i1)couldbeedgesandnotsuperedges;foreachsuchedgeei,theremustbeanassociatedleafoccurrenceofthecorrespondingaiinsometree(byLemma2);wecandoajoinofthepartialsuperedgeincidentonthisleafoccurrencewitheitoconverteitoasuperedgecontainingai.Nowwehaveonlysuperedgesleft.First,someofthesesuperedgescouldhaveendpointsindistinctcomponents,sothosearedone.Second,pairupandmateasmanyremainingei's(i1)aspossiblesotheai'sareidenticalwithinapair;eachoftheresultingsuperedgeshasendpointsindistinctcomponents;thesearedoneaswell.Thisleavesuswithe0andasubsetofotherei'swithdistinctai's.WenowperformmatesamongtheseasinFig.14.Theresultingsuperedgesconnecttogetherallofthesecomponentsinquestion.Second,consideranyequivalenceclassofblack-terminalcomponentssothattheassociatedfreesu-peredges/edgesspeciedbyCorollary1allhaveblackverticesincommonwiththeseedsuperedgeofthesamecomponentComp.Lete0denotethatsuperedge.e0isstillintactattheendofPhase1byprun-ingstep1inSection8.3.1andbyCorollary1.ThesameprocessasinthepreviousparagraphsuggeststransformationswhichwillconnectallofthesecomponentstogetherwithComp.Finally,forwhite-terminal-9components,nothingfurtherneedbedonebecausetheirassociatedsu-peredgesasspeciedbyCorollary1connectacrosscomponents.Thiscompletesthealgorithm.9AfastGomory-HutreealgorithmInthissectionwepresentourfastalgorithmforcomputingaGomory-Hutree.Thealgorithmusessubmod-ularityofcuts(Fact1)andTheorem7whichfollowsfromFact1.44a3EEDDa1a2a3ABCAa1BCa2a3a3a1a1a2a2Figure14:ACascadeofMates.w2w4w2w1w3b1b2b3b4ST2T3T4T1w1w3w4Figure15:Thecurrent(partial)Gomory-HutreeTontheleftandG(S)foranodeSinTontheright;noteonlyverticesinG(S)areshown,edgesarenotshown.TheGomory-Hutreeconstructionalgorithm[GH61]initializesthecuttreeTtoasinglenodethatcontainstheentirevertexset.Asweproceed,nodesofTwillpartitiontheverticesofG.EachnodeSinTrepresentsacollectionofverticesv(S)fromG.ConsidernodeSandthesubtreesT1:::ThsubtendedatthehneighborsofnodeSinT.Wedenev(Ti)=[S02Tiv(S0).ObtainanewgraphG(S)(calledtherelevantgraphforS)fromGbycompressingallverticesinv(Ti)foreachi(seeFig.15);thisgraphhashcompressedverticesandjv(S)jsingletonvertices;thelattercomprisethesetofterminalvertices;forsimplicity,wewilluseSitselftodenotethesetv(S).Thealgorithmnowproceedsasfollows.RepeatedlypickanodeSofTcontainingmorethanonevertexfromGandconsiderG(S).Pickanytwoterminalverticess;tinG(S)andndthes-tmin-cut(possiblyviaamaxowcomputation)inthegraphG(S).Theorem7ensuresthatthes-tmin-cutthusobtained(wecallitC)isa

lsoas-tmin-cutintheoriginalgraph.Now,inT
lsoas-tmin-cutintheoriginalgraph.Now,inT,thenodeSissplitintoS1andS2accordingtoCandthetwonodesthusformedarejoinedbyanedgeofweightequaltothesizeofC.Further,alltheneighboringsubtreesofSbecomeneighboringsubtreesofS1orS2dependinguponwhichsideofCthey45lieon.ThealgorithmterminateswhenallthenodesofTbecomesingletonsets.ThusTisaweightedtreewhosenodesaretheverticesofV.ItcanbeshownthatTcapturesall-pairsmin-cuts.OurApproach.WeusethesameframeworkasabovebutmodifytheprocessingofG(S)asfollows.Insteadofrepeatedlychoosings-tpairsasabove,weuseTheorem10toobtainthefollowinginoneshot:foreachterminalvinG(S),theminimalmin-cutinG(S)separatingvfromarootvertexr,whererischosenuniformlyatrandomfromtheterminalsinG(S).WenowreneSinTbyinsertingeachoftheminimalmin-cutsfromtheabovefamily,asdescribedbelow.Oncealltheseminimalmin-cutshavebeeninserted,theprocedurecontinuesbypickinganothernodeofTwithmorethanonevertex,untilallnodesaresingleton.MinimalMin-CutWitnesses.Foreveryminimalmin-cut(B;V(G(S))B)foundabovewithrespecttorootr,thereexistsaterminalvertexvinG(S)suchthatv2B,r2V(G(S))B)andnosubsetofBcontainingvisamin-cutseparatingvfromr.AllsuchterminalverticesvaresaidtobewitnessesforBandaredenotedbyw(B).LaminarFamilies.Notethatanytwominimalmin-cutsareeitherdisjointorcontainedonewithintheotherbyFact1.Soacollectionofminimalmin-cutsformsalaminarfamilyF,wheretheoutermostcutisthetrivialcutwhichhasallverticesinsideitandallfurthernestedcutsaretheactualminimalmin-cutswithrespecttothechosenrootr.Forinstance,inFig.16,theoutermostcuthasallverticesw1:::w4andb1:::b4,andthereare3nestedcuts,eachaminimalmin-cutwithrespecttorootw4.Ingeneral,thelevelofnestingcouldbearbitrary.ReningNodeSinT.InthecurrentGomory-HutreeT,wereplacethenodeSwiththefollowingtreestructureobtainedfromthelaminarfamilyFasfollows.Createanewtreenode (B)foreachcutBinF.Associatewiththisnode,verticesinthesetw(B).FortheoutermostcutB,w(B)isdenedtocontainonlytherootr.Foreachnon-terminalvertexbimmediatelyinsideacutB,addanedgefromnode (B)totherootoftheTi(wherebwasobtainedbycompressingverticesassociatedwithnodesinTi);thisedgehasthesameweightastheedgefromStoTiinT.IfBhasaparentcutB0whichcontainsBinthelaminarfamilythen (B)hasanedgeto (B0)ofweightequaltothesizeofthecut(B;V(G(S)B)inG(S).Fig.16illustratestheresultingtree.ThegureontheleftshowsacutBconsistingofoneterminalw4andonenon-terminalb4and3childcuts,eachconsistingofoneterminalwiandanon-terminalbi,fori=1;2;3.Ontherightwehavethecorrespondinglaminartree.ItiseasytoseethatthisnewGomory-HutreeistheoldtreeTaugmen

tedwithexactlytheminimalmin-cutsfoundabo
tedwithexactlytheminimalmin-cutsfoundabove,asrequired.Analysis.Letuspartitionthevarioussubproblems(theseareelementsofthequeueQ)thatwespawninouralgorithmintolayers.Layer(0)consistsoftheproblem(V;G).Layer(1)consistsofthesubproblems(B;G(B))thatcorrespondtoalltheminimalmin-cutsgeneratedbytheproblem(V;G)inLayer(0).Re-cursively,Layer(i)consistsofthesubproblemscorrespondingtoalltheminimalmin-cutsgeneratedbyalltheproblemsinLayer(i1).NotethatcorrespondingtoeachlayerLayer(i1),thereexistsacorre-sponding(partial)Gomory-Hutree;reningeachnodeinthistreeyieldstheGomory-HutreecorrespondingtoLayer(i).OurrstclaimisthatthetotaltimecomplexityoftheproblemsinvolvedinthesamelayerisO(mclogn),wherec=maxu;v2Vc(u;v).Suchaclaimwouldbeimmediateifitwerethecasethatalltheproblemsinvolvedinthesamelayerwereedge-disjoint.Butthatisnotthecaseandthesameedgemightbepresentinvarioussubproblemsinthesamelayer.HoweverwewillshowthatthetotalnumberofoccurrencesofalledgessummedoverallthesubproblemsinthesamelayerisO(m).46w1w1w2w2w3w3w4w4b1b2b3b4treeT1forb1treeT2forb2treeT3forb3treeT4forb4Figure16:Thelaminarfamilyofacutandthecorrespondinglaminartree.Algorithm5OuralgorithmforconstructingaGomory-HutreeforthegraphG=(V;E)–InitializethetreeTtoasinglenodecontainingtheentirevertexsetV.–InitializethequeueQtotheset(V;G).fAnyelementinthequeueisapair(setofterminals,therelevantgraph).gwhilethequeueQisnotemptydo–deletetherstelement(S;G(S))fromQ.ifjSj�1then–pickavertexinSuniformlyatrandomastherootr.–identifythelaminarfamilyofallminimalmin-cutswithrespecttorinG(S).–reneSinTbyinsertingeachofthesecutsasdescribedearlier.–foreachoftheabovecutsB,addtheelement(B;G(B))totheQ,whereG(B)isobtainedfromG(S)bycontractingtheverticesofG(S)Btoasinglevertex.endifendwhileLemma34.ThetotalnumberofalledgesinvolvedinallsubproblemsinthesamelayerisO(m).Proof.TheedgesthatarepresentinmorethanoneprobleminLayer(i)correspondtoedgesthatcrossthecutspresentinthe(partial)Gomory-HutreeT0afterallLayer(i1)problemshavebeenprocessed.Weneedtosumoveralledgese,thenumberofcutsofT0thatanyedgeecrosses.ThisisequivalenttosummingthetotalsizesofthecutsinT0.Thissumisboundedfromabovebyc1+c2++cn1,wherec1;:::;cn1aretheweightsofthen1edgesofthenalGomory-HutreeT.NowwewillshowthatthesumofweightsofalledgesofTisatmost2m.RoottheGomory-HutreeT=(V;E)atanarbitraryvertexanddenethefunctionl:E!Vsuchthatl(e)isthedeeperofthetwoendpointsofeinT.Itiseasytoseethatlisanone-to-onemapping.Now,foranyedgee=(u;v)2E,theweight,w(e),ofeintheGomory-HutreeTisc(u;v)

.Withoutlossof47generality,assumethatl(
.Withoutlossof47generality,assumethatl(e)=u.Now,since(u;Vnu)representsau-vcutofsizedeg(u),itfollowsthatw(e)=c(u;v)deg(u)=deg(l(e)).SummingoveralltheedgesinEandnotingthatthefunctionlisone-to-one,wehavePe2Ew(e)Pv2Vdeg(v)=2m.Sincethecostofcomputingallminimalmin-cutswithrespecttotherootinanysubproblemisO(m0clogn)wherem0isthenumberofedgesinthatsubproblem(byTheorem10),Lemma34immediatelyimpliesthatthetotalcomplexityoftheproblemsinvolvedinthesamelayerisO(mclogn).Nowweshowthatwithprobability11=n,thenumberoflayersisO(logn).Werstprovethefollowinglemma.Lemma35.Let(C;G(C))beanyparticularsubproblem.Let(P;G(P))beitsparentproblem.LetjPj(similarly,jCj)denotethenumberofterminalverticesinthesetP(resp.,C).ThenPr(jCjjPj=2)1=2.Proof.Inthesubproblem(C;G(C)),Cisaminimalmin-cutthatseparatestherootrinthesetP(oftheparentproblem(P;G(P)))fromsometerminalvertexv2C.Sincethisisaminimalmin-cut,thesidecontainingvinChasconnectivityatleastonehigherthanthesizeofthisr-vcut.IfalltheterminalsofParearrangedinnon-decreasingorderoftheirconnectivityfromv,thentheprobabilitythattherootrisoneoftherstjPj=2verticesinthisorder(onlythencanthenumberofterminalsinCbeatleastjPj=2)isatmost1=2,sincerwaschosenuniformlyatrandomfromthejPjterminals.Thisprovesthelemma.Theorem11.Withprobability11=n,thenumberoflayersisO(logn).Proof.Considerthepathfromaleafsubproblem(C`;G(C`))inLayer(`)totherootproblem((V;G)inLayer(0)).Eachedgeinthispathisfromasubproblem(Cj;G(Cj))inLayer(j)toitsparentproblem(Cj1;G(Cj1))inLayer(j1).DenearandomvariableXjasfollows:Xjis1ifjCjjjCj1j=2,0otherwise.First,observethatXj'sareindependentrandomvariablessincetherootischosenindependentlyineachlayer.ThususingChernoffbound,theprobabilitythatagivensubproblemisinlayer`�4lognisatmost1=n2.Sincethereareatmostnleaves,usingtheunionbound,thenumberoflayersisO(logn)withprobability11=n.Thisleadstothefollowingtheorem,whichgivesthetimecomplexityofthealgorithm.Theorem12.Withprobability11=n,thetimecomplexityofourGomory-HutreealgorithmisO(mclog2n).10ConclusionandFutureworkWegaveadeterministicalgorithmfortheSteineredgeconnectivityprobleminundirected/Euleriandirectedgraphsthatrunsin~O(m+nc2)time,wherecistheedgeconnectivityoftheSteinersetSVandn,marethenumberofverticesandedgesintheinputgraph.WeappliedthisalgorithmtodesignafasteralgorithmfortheGomory-Hutreeprobleminundirectedgraphs.Thisalgorithmhasarunningtimeof~O(mF)withhighprobability,whereFisthemaximumu-vedgeconnectivity,overallpairsofverticesu;v.OneobviouschallengeistoderandomizeourGomory-Hutreea

lgorithmandachievesimilartimebounds.Anot
lgorithmandachievesimilartimebounds.AnotherquestioniswhethertheSteineredgeconnectivityproblemcanbesolvedinMonteCarlonear-lineartime(independentoftheSteinerconnectivityvalue).AnotherimportantquestionisthatofextendingourapproachtodesignfasteralgorithmsforbuildingGomory-Hutreesinweightedgraphs.OurGomory-Hutreealgorithmindeedworksforintegerweightedgraphstoo,howeverarunningtimeof~O(mF),whereFisthemaximumu-vedgeconnectivity,overallpairsofverticesu;v,isnotinteresting(andisnotevenpolynomialtime)forweightedgraphs.4811AcknowledgmentsWethanktheanonymousrefereesfortheirfeedback.References[Ben95]Andr´asA.Bencz´ur.Counterexamplesfordirectedandnodecapacitatedcut-trees.SIAMJ.Comput.,24(3):505–510,1995.[BHKP07]AnandBhalgat,RameshHariharan,TelikepalliKavitha,andDebmalyaPanigrahi.An˜o(mn)gomory-hutreeconstructionalgorithmforunweightedgraphs.InSTOC,pages605–614,2007.[BHKP08]AnandBhalgat,RameshHariharan,TelikepalliKavitha,andDebmalyaPanigrahi.Fastedgesplittingandedmonds'arborescenceconstructionforunweightedgraphs.InSODA,pages455–464,2008.[BJFJ95]JørgenBang-Jensen,Andr´asFrank,andBillJackson.Preservingandincreasinglocaledge-connectivityinmixedgraphs.SIAMJ.DiscreteMath.,8(2):155–178,1995.[CH03]RichardColeandRameshHariharan.Afastalgorithmforcomputingsteineredgeconnectivity.InSTOC,pages167–176,2003.[DV94]YemDinitzandAlekVainshtein.Theconnectivitycarcassofavertexsubsetinagraphanditsincrementalmaintenance.InSTOC,pages716–725,1994.[Edm69]JackEdmonds.Submodularfunctions,matroids,andcertainpolyhedra.InCalgaryInterna-tionalConferenceonCombinatorialStructuresandtheirApplication,pages69–87,1969.[Edm72]JackEdmonds.Edgedisjointbranchings.pages91–96,1972.[Gab95]HaroldN.Gabow.Amatroidapproachtondingedgeconnectivityandpackingarbores-cences.J.Comput.Syst.Sci.,50(2):259–273,1995.[GH61]R.E.GomoryandT.C.Hu.Multi-terminalnetworkows.J.Soc.Indust.Appl.Math.,9(4):551–570,1961.[GT01]AndrewV.GoldbergandKostasTsioutsiouliklis.Cuttreealgorithms:Anexperimentalstudy.J.Algorithms,38(1):51–83,2001.[Gus90]DanGuseld.Verysimplemethodsforallpairsnetworkowanalysis.SIAMJ.Comput.,19(1):143–155,1990.[HKP07]RameshHariharan,TelikepalliKavitha,andDebmalyaPanigrahi.Efcientalgorithmsforcomputingalllowstedgeconnectivitiesandrelatedproblems.InSODA,pages127–136,2007.[KL02]DavidR.KargerandMatthewS.Levine.Randomsamplinginresidualgraphs.InSTOC,pages63–66,2002.49[WGMV95]DavidP.Williamson,MichelX.Goemans,MilenaMihail,andVijayV.Vazirani.Aprimal-dualapproximationalgorithmforgeneralizedsteinernetworkproblems.Combinatorica,15(3):4

Related Contents


Next Show more