dynamic generators of topologically embedded graphs

13
arXiv:cs/0207082v1 [cs.DS] 24 Jul 2002 Dynamic Generators of Topologically Embedded Graphs David Eppstein UC Irvine, Dept. of Information & Computer Science [email protected] Abstract. We provide a data structure for maintaining an embedding of a graph on a surface (represented combi- natorially by a permutation of edges around each vertex) and computing generators of the fundamental group of the surface, in amortized time O(log n + log g(log log g) 3 ) per update on a surface of genus g; we can also test orientability of the surface in the same time, and maintain the minimum and maximum spanning tree of the graph in time O(log n + log 4 g) per update. Our data structure allows edge insertion and deletion as well as the dual opera- tions; these operations may implicitly change the genus of the embedding surface. We apply similar ideas to improve the constant factor in a separator theorem for low-genus graphs, and to find in linear time a tree-decomposition of low-genus low-diameter graphs. 1 Introduction In this paper we introduce a tool, the tree-cotree decomposition, for constructing generators of fundamental groups of surfaces, and apply it to several algorithmic problems for graphs embedded on surfaces. The fundamental group of a surface measures the ability to transform one curve continuously into an- other. Two closed curves c 0 and c 1 on a surface are homotopic if there exists a continuous map from the cylinder [0, 1] × S 1 to the surface such that each cylinder boundary i × S 1 is mapped homeomorphically to curve c i . The elements of the fundamental group are equivalence classes of curves under homotopy. The identity element is the class of curves homotopic to the boundary of a disk, the inverse of a curve is formed by tracing the same curve backwards, and the concatenation of two curves forms their product in the group. For further exposition see any topology text, e.g. [17]. Fundamental groups are often infinite, but can be specified finitely by a system of generators and rela- tions. The generators of a fundamental group are a system of closed curves with the property that any other curve can be generated (up to homotopy) by concatenations of closed curves in the system. For instance, on a torus, two natural closed curves to use as generators are an equatoral circle g 0 and a longitudinal circle g 1 ; any other closed curve c on the torus is homotopic to a curve g i 0 g j 1 that winds i times around the equa- tor followed by j turns around a longitude. The relations of a fundamental group describe null-homotopic combinations of generators: in the torus, the relation g 0 g 1 g 1 0 g 1 1 = 1 implies that the group is commutative. In addition to their topological interest, fundamental groups and their generators have other applications. Cutting a surface along its generator curves produces a planar surface with holes at the cuts, and Erickson and Har-Peled [8] have recently investigated the problem of finding short cutsets in nonplanar surfaces. As we will see, this cutting technique allows one to apply planar graph algorithms such as separator construc- tion [1] and tree decomposition [5] to nonplanar graphs. We will also show how to use the generators to test orientability of surfaces and maintain minimum spanning trees of graphs embedded in surfaces. Subgroups of the fundamental group correspond to covering spaces, the most important of which is the universal cover. In the example of the torus, the universal cover is a plane, and the endpoints of curves g i 0 g j 1 lift to a planar lattice. If one chooses any pair of generators of the lattice, curves from the origin to these points map to a pair of generators for the fundamental group of the torus. Thus construction of generators is also closely related to lattice basis reduction, Euclid’s algorithm, and continued fractions. 1.1 New Results We show the following results.

Upload: mirza-ahad-baig

Post on 24-Dec-2015

213 views

Category:

Documents


0 download

DESCRIPTION

Abstract. We provide a data structure for maintaining an embedding of a graph on a surface (represented combinatoriallyby a permutation of edges around each vertex) and computing generators of the fundamental group ofthe surface, in amortized time O(log n + log g(log log g)3) per update on a surface of genus g; we can also testorientability of the surface in the same time, and maintain the minimum and maximum spanning tree of the graph intime O(log n + log4 g) per update. Our data structure allows edge insertion and deletion as well as the dual operations;these operations may implicitly change the genus of the embedding surface.We apply similar ideas to improvethe constant factor in a separator theorem for low-genus graphs, and to find in linear time a tree-decomposition oflow-genus low-diameter graphs.

TRANSCRIPT

Page 1: Dynamic Generators of Topologically Embedded Graphs

arX

ivc

s02

0708

2v1

[cs

DS

] 24

Jul

200

2

Dynamic Generators of Topologically Embedded Graphs

David Eppstein

UC Irvine Dept of Information amp Computer Scienceeppsteinuciedu

Abstract We provide a data structure for maintaining an embedding of agraph on a surface (represented combi-natorially by a permutation of edges around each vertex) andcomputing generators of the fundamental group ofthe surface in amortized timeO(logn + logg(log logg)3) per update on a surface of genusg we can also testorientability of the surface in the same time and maintain the minimum and maximum spanning tree of the graph intimeO(logn + log4 g) per update Our data structure allows edge insertion and deletion as well as the dual opera-tions these operations may implicitly change the genus of the embedding surface We apply similar ideas to improvethe constant factor in a separator theorem for low-genus graphs and to find in linear time a tree-decomposition oflow-genus low-diameter graphs

1 Introduction

In this paper we introduce a tool thetree-cotree decomposition for constructing generators of fundamentalgroups of surfaces and apply it to several algorithmic problems for graphs embedded on surfaces

The fundamental groupof a surface measures the ability to transform one curve continuously into an-other Two closed curvesc0 andc1 on a surface arehomotopicif there exists a continuous map from thecylinder [0 1] times S1 to the surface such that each cylinder boundaryi times S1 is mapped homeomorphicallyto curveci The elements of the fundamental group are equivalence classes of curves under homotopy Theidentity element is the class of curves homotopic to the boundary of a disk the inverse of a curve is formedby tracing the same curve backwards and the concatenation of two curves forms their product in the groupFor further exposition see any topology text eg [17]

Fundamental groups are often infinite but can be specified finitely by a system ofgeneratorsandrela-tions The generators of a fundamental group are a system of closedcurves with the property that any othercurve can be generated (up to homotopy) by concatenations ofclosed curves in the system For instance ona torus two natural closed curves to use as generators are anequatoral circleg0 and a longitudinal circleg1 any other closed curvec on the torus is homotopic to a curvegi

0gj1 that windsi times around the equa-

tor followed by j turns around a longitude The relations of a fundamental group describe null-homotopiccombinations of generators in the torus the relationg0g1gminus1

0 gminus11 = 1 implies that the group is commutative

In addition to their topological interest fundamental groups and their generators have other applicationsCutting a surface along its generator curves produces a planar surface with holes at the cuts and Ericksonand Har-Peled [8] have recently investigated the problem offinding short cutsets in nonplanar surfaces Aswe will see this cutting technique allows one to apply planar graph algorithms such as separator construc-tion [1] and tree decomposition [5] to nonplanar graphs We will also show how to use the generators to testorientability of surfaces and maintain minimum spanning trees of graphs embedded in surfaces

Subgroups of the fundamental group correspond tocovering spaces the most important of which is theuniversal cover In the example of the torus the universal cover is a plane and the endpoints of curvesgi

0gj1

lift to a planar lattice If one chooses any pair of generators of the lattice curves from the origin to thesepoints map to a pair of generators for the fundamental group of the torus Thus construction of generators isalso closely related to lattice basis reduction Euclidrsquos algorithm and continued fractions

11 New Results

We show the following results

ndash We provide a simple dynamic graph data structure for maintaining a dynamic graph embedded in a2-manifold subject to updates that insert or delete edgeschanging the ordering of edges around eachvertex and thus implicitly changing the underlying 2-manifold Our structure can also handle the dualoperations of edge contraction and expansion and maintains a set of generators for the fundamentalgroup of the surface as well as additional information suchas the minimum spanning tree of the graphor the orientability of the surface in amortized timeO(g logn) per update whereg is the genus of thesurface at the time of each update

ndash By combining our simple structure with ideas of separator based sparsification [6] and recent poly-logarithmic algorithms for dynamic connectivity in general graphs [12 18] we further improve ourtime bounds toO(logn + logg(log logg)3) per update for generators and orientability andO(logn +(logg)4) per update for minimum spanning trees

ndash We improve by a factor ofradic

2 the constant factor in the best previous separator theoremfor boundedgenus graphs [1]

ndash We provide an efficient algorithm for our previous nonconstructive result that genusg graphs withdiameterD have a tree-decomposition with treewidthO(gD) [5]

12 Related Work

The previous work most close to ours is on construction of canonical schemata and cutsetsA canonical schemafor a 2-manifold is a set of generators for its fundamental group having a single

prespecified relation (prod

g2ig2i+1gminus12i gminus1

2i+1 for oriented surfacesprod

g2i for unoriented surfaces) The genera-

tors must have a common basepoint but unlike the ones in our construction they are not required to followthe edges of a given graph on the surface they may pass acrossthe interior of cells Vegter and Yap [19]showed that canonical schemata exist with total complexityO(ng) whereg is the surface genus this boundis tight in the worst case and they also showed that a canonical schema can be found in timeO(ng) Thegenerators we find can have the sameΘ(gn) total complexity but we can find an implicit representationofthe generators in linear time However the generators we find are not necessarily in canonical form

Recently Erickson and Har-Peled [8] studied the problem offinding a cutset that is a set of edgesthe complement of which forms a topological disk on the givensurfaces Erickson and Har-Peled foundalgorithms for computing minimum-length cutsets in polynomial time for bounded-genus embeddings butshowed the problem to be NP-complete in the case of unboundedgenus In the applications to tree decom-position and separator theorems we use our techniques to find cutsets with a guaranteed bound on the totallength but our cutsets may be far from the minimum possible length

Planar separator theorems have been long studied [14] and there has been much work on improvedconstants for such theorems [16] More generally for graphs embedded on genusg surfaces a separatorwith O(

radicgn) vertices can be found inO(n) time [1] Specifically Aleksandrov and Djidjev [1] showed

that for anyǫ gt 0 one can find a set ofradic

(16g + O(1ǫ))n vertices the removal of which partitions thegraph into components of size at mostǫn Our techniques improve the constant factors in this result Wealso apply similar ideas to the computation of tree-decompositions for low-diameter low-genus graphs ourprevious work [5] proved the existence of such decompositions but did not provide an efficient algorithmfor finding them

The main inspiration for this paper was previous work on dynamic connectivity and minimum spanningtrees in embedded planar graphs [7] which worked by decomposing the graph into two subgraphs a min-imum spanning tree and a maximum spanning cotree We use a similar decomposition here however forsurfaces of nonzero genus we end up with leftover edges that belong neither to the tree nor to the cotreeThese extra edges are what we use to form the generators of thesurface We also combine the dynamic graphalgorithms from that previous work with a technique for maintaining small representative subgraphs [6] and

2

Fig 1 Left an embedding ofK33 in the projective plane The edges drawn crossing the dashedcircleconnect to the opposite side of the circle there is one hexagonal cell in the center surrounded by threequadrilaterals that form a Mobius strip Right a gem representation of the embedding The flags of theembedding are shown as triangles the dashed edges represent connections of typeSV the dotted edgesrepresent connections of typeSE and the solid edges represent connections of typeSC

more recent methods of Holm et al [12] to achieve time boundsthat match the best of these dynamic graphalgorithms

2 Representing an Embedding

We considermaps graphs embedded on two-dimensional manifolds in such a way that the cells of theembedding are disks We do not require that our graphs be simple Such an embedding on an orientablemanifold can be represented by specifying a clockwise ordering of the edges around each vertex [10 Sed-ction 324] However for our purposes it is convenient to use a somewhat more general representationthe graph-encoded map [3 13] which also allows unorientable embeddings We now briefly describe thisrepresentation

Suppose we are given a map such as the embedding ofK33 shown on the left of Figure 1 Aflag of themap is defined to be the triple formed by a mutually adjacent vertex edge and cell of the map For a flagFlet V(F) denote the vertexE(F) denote the edge andC(F) denote the cell We define three operations thatchange one flagF into another

ndash SV(F) is a flag formed by the edge and cell ofF but with a different vertex found at the other endpointof E(F)

ndash SE(F) is a flag formed by the vertex and cell ofF but with a different edge found by tracing around theboundary ofC(F) from E(F) in the direction ofV(F)

ndash SC(F) is a flag formed by the vertex and edge ofF but with a different cell the cell that is the next oneclockwise or counterclockwise aroundV(F) from C(F) in the direction ofE(F)

Each of these operations produces a unique well-defined flagand the neighboring relation betweenflags is symmetricSV(SV(F)) = SE(SE(F)) = SC(SC(F)) = F In a computer one can represent theseflags as objects in an object-oriented language and store with each flag a pointer or reference to its threetypes of neighbor Graphically we view the flags as verticesin a graph and the operations as unorientededges connecting each flag to its neighborsSV(F) SE(F) andSC(F) as shown on the right of Figure 1Although we see this gem as drawn in a projective plane the gem representation of an embedding is purely

3

graph-theoretic and independent of any drawing of the gem The edges of this graph should be viewed ashaving three colors representing the type of operation generating the edge in the figure these are shown asdashed dotted and solid respectively

For each vertex of the map withd adjacent edges the resulting gem has a 2d-cycle with edges alternatingbetween typesSE and SF For each edge of the map the gem has a quadrilateral with edges alternatingbetween typesSV andSC And for eachk-gon cell of the map the gem has a 2k-cycle with edges alternatingbetween typesSV andSE In this way every map generates a 3-regular 3-edge-colored graph in which theSV-SC cycles all have four edges Conversely given any such graph we can recover the original map byforming ak-gon cell for each 2k-cycle of edges of typesSV andSE and by gluing these cells together into amanifold whenever the corresponding edges of typesSV are part of a four-cycle of typesSV andSC

Any mapM has adual mapMlowast on the same surface formed by creating a dual vertexf lowast within eachfacef of the primal map and creating a dual edgeelowast for every primal edgee so that ife is adjacent to twofacesf1 andf2 thenelowast connectsf lowast1 andf lowast2 by a path that crossese once and crosses no other primal or dualedge In the gem representation the dual can be formed very simply by reversing the roles of the gem edgesof typesSV andSC

In our dynamic graph data structures we will augment the gemrepresentation by balanced binary treesfor the cycles corresponding to each vertex and cell of the map in this way we can quickly look up whichvertexrsquos or cellrsquos cycle contains a given edge of the gem andwhether two edges on the same cycle are in thesame or opposite orientations around the cycle

3 Trees and Generators

A spanning treeof a graph or map is just a tree formed by some subset of the edges of the graph thatincorporates all the vertices of the graph IfClowast is a spanning tree of the dual of a map we callC = e | elowast isinClowast a spanning cotreeof the map If the edges of a map are given weights the weight of a tree or cotree isdefined to be the sum of the weights of its edges

Lemma 1 Let a mapM be given with distinct weights on each of its edges Then theminimum weightspanning tree ofM and the maximum weight spanning cotree ofM are disjoint

Proof Let ebe an edge in the minimum spanning tree ofM Then removinge from the minimum spanningtree results in a forestF with two connected components letF1 be one of those components Then thesequence of faces ofM surroundingF1 forms a (possibly non-simple) cycle inMlowast consisting of the dualsof all edges connectingF1 to F2 Sincee belongs to the minimum spanning treeelowast must be the shortestedge in this dual cycle and so cannot belong to the maximum spanning tree ofMlowast ⊓⊔

In the special case of planar graphs the minimum spanning tree and maximum spanning cotree forma partition of all the edges of the graph [7] We define atree-cotree partitionof M to be a triple(T C X)whereT is a spanning tree ofM C is a spanning cotree ofM and the three setsT C andX are disjointand together include all edges ofM In particular ifT is the minimum spanning tree andC is the maxi-mum spanning cotree then(T C E(M) (T cup C)) is a tree-cotree decomposition By assigning weightsappropriately we can use Lemma 1 to find a tree-cotree decomposition involving any given treeT or cotreeC More generally ifT andClowast are forests such thatT andC are disjoint we can assign weights to makeTbecome part of the minimum spanning tree andC become part of the maximum spanning cotree extendingT andC to a tree-cotree decomposition

We now show how these decompositions are connected to fundamental groups of surfaces Thefunda-mental groupof a spaceS is most commonly defined relative to some base pointx0 isin S but for suitablespaces (including the 2-manifolds considered here) it is independent of the choice of this base point Definea loop to be a continuous functionf [0 1] 7rarr Ssatisfyingf (0) = f (1) = x0 and define two loopsf0 andf1

4

to behomotopy equivalentif there exists a continuous functionf [0 1]2 7rarr Ssuch thatf (x i) = fi(x) andf (0 i) = f (1 i) = x0 Define theproductof two loopsf0 andf1 to be the loop

f (x) =

f0(2x) for 0 le x le 12f1(2xminus 1) for 12 le x le 1

Then it can be shown that homotopy equivalence is an equivalence relation and that the homotopy equiv-alence classes of loops form a group thefundamental group under homotopy equivalence In this groupinverses can be found by reversing the direction of a loop iff is a loopg(x) = f (1minus x) is a loop inverse tof A set of loops is said togeneratethe fundamental group if every other equivalence class of loops can bereached by products of these generators and their inverses

If we are given a rooted treeT and oriented edgee isin T with the base pointx0 of the fundamental loopat the root ofT we can define a loop loop(T e) by following a path inT from x0 to the head ofe thentraversing edgee to its tail and finally following a path inT from that tail back tox0 When consideringthese loops as generators of the fundamental group the orientation ofe is unimportant since reversing theedge merely produces the inverse group element

Lemma 2 Let (T C X) be a tree-cotree decomposition of mapM Then the loopsloop(T e) | e isin Xgenerate the fundamental group of the surface on whichM is embedded

Proof Contract the edges inT into the rootx0 of T while leaving the surface unchanged outside of a smallneighborhood ofT this contraction does not change the fundamental group of the surface In the contractedimage the loops from the statement of the lemma are each contracted into a single edge connectingx0 toitself Decompose the surface into a setS1 consisting of a small neighborhood of the set of these contractedloops and a setS2 consisting of the faces of the map and the cotree edges inC Then by the Seifert ndash VanKampen theorem [17 Section 34] the fundamental group of the overall surface can be formed by combiningthe generators and relations of the fundamental groups of these two pieces with additional relations describ-ing the way these two pieces fit togetherS1 can be contracted to a graph with one vertex and|X| self-loopswhich has a fundamental group with each of these loops as generators and no relationsS2 is topologicallya disk (since it consists of a collection of disk faces glued together in the pattern of a tree) so it has a trivialfundamental group The fundamental group of the overall surface then is generated by the loops describedin the statement of the lemma with a single relation formed by the concatenation of these loops around theboundary ofS2 ⊓⊔

Of course for any treeT the loopsloop(T e) | e isin T also generate the fundamental group butin general this will form a much larger system of generatorsThe advantage of the system of generatorsprovided by Lemma 2 is its small cardinality proportional to the genus of the surface

The same tree-contraction argument used in Lemma 2 also shows that the edges in the loopsloop(T e) |eisin X form a cutset

4 Dynamic Generators

41 Update Operations

Following [7] we allow four types of update operation insertion of a new edge between two verticesdeletion of an edge dual edge insertion (expansion) and dual edge deletion (contraction) The effect ofthese updates on the gem representation is shown in Figure 2

The location of an edge insertion can be specified by a pair of gem verticesp andq shown as shadedtriangles in the figure We then subdivide the two gem edgesSE(p) andSE(q) into paths ofSE andSC edgespreserving the connectivity of theSE-SC cycles representing vertices in the gem and create a new graph

5

Fig 2 Effects of edge insertion and deletion and their duals on thegem representation

edge (represented in the gem by a 4-cycle ofSV andSC edges) using theSC edges of the subdivided pathsin such a way that the new gem edgesSE(p) andSE(q) are adjacent to a common edge of typeSV

In the most typical case of an edge insertion (Fig 2 upper right) the two edgesSE(p) andSE(q) aredistinct each of these edges is subdivided into a three-edge path and the two new vertices on each path areconnected in pairs by newSV edges We distinguish three subcases of this operation depending on whichcells of the map contain the endpoints of the inserted edge

ndash In a cell-merging insertion the two endpoints of the inserted edge are attached into distinct cells ofthe map that is the two gem edgesSE(p) andSE(q) belong to distinctSE-SV cycles The effect of theinsertion is to split each of these two cycles into paths andto splice these two paths together into asingle cycle via the newly createdSV edges We are increasing the number of edges and decreasing thenumber of cells so the surfacersquos genus increases Topologically this can be viewed as gluing a handlebetween the two cells and routing the new edge along this handle

ndash In acell-splitting insertion the two endpoints of the inserted edge belong to a single cell of the map andif the SE-SV cycle representing this cell is consistently oriented then SE(p) andSE(q) both point towardsor both point away from their endpointsp andq respectively The effect of the insertion is to split theSE-SV cycle into two paths and then reconnect the paths into two cycles forming two cells connectedacross the new edge We are increasing both the number of edges and the number of cells so the genusand the topology of the surface are preserved This was the only type of edge insertion allowed in [7]

ndash In acell-twisting insertion the two endpoints of the inserted edge belong to a single cell of the map butSE(p) andSE(q) are not consistently oriented The effect of the insertion is to split theSE-SV cycle intotwo paths and then reconnect the paths into a single cycle with the orientation of the two paths reversedfrom their previous situation We are increasing the numberof edges while preserving the number ofcells so the genus increases Topologically this can be viewed as gluing a crosscap into the cell androuting the new edge through it

Each of these types of insertion has a complementary deletion specified by the edge to be deleted whichwe call acell-splitting deletion acell-merging deletion or anuntwisting deletionrespectively In addition

6

we allow the dual operations to insertions and deletions asshown on the upper right of the figure dualdeletion is more familiar as the operation of edge contraction The dual of a cell-merging insertion mergestwo vertices of the graph while increasing the genus the dual of a cell-splitting insertion splits a vertexinto two adjacent vertices and the dual of a cell-twisting insertion changes the order of the edges and cellsaround a vertex We do not describe these in detail because our data structure will be self-dual so that eachdual operation is performed exactly as the primal operationsubstitutingSV for SC and vice versa

Finally it is possible to specify an insertion in whichSE(p) andSE(q) are not distinct Ifp 6= q whileSE(p) = SE(q) (Fig 2 lower left) we subdivideSE into a path of five edges and connect the four new gemvertices into anSV-SC cycle in such a way that adjacent vertices of the cycle are connected top andq Thiscan be viewed as a special case of a cell-splitting insertionin which the two endpoints of the inserted edgeare placed next to each other at the same vertex creating a one-sided cell contained within the previouslyexisting cell The dual of this operation adds a new degree-one vertex to the graph

If p = q we perform an edge insertion by again subdividingSE into a path of five edges and connectingthe four new gem vertices into anSV-SC cycle in such a way that opposite vertices of the cycle are connectedto p and the other endpoint ofSE(p) Edge insertion withp = q and dual edge insertion withp = q producethe same result shown in the lower right of Fig 2 This can beviewed as a special case of a cell-twistinginsertion in which the two endpoints of the inserted edge areplaced next to each other at the same vertex

42 Simple Dynamic Generators

We now describe a simple scheme for maintaining generators and minimum spanning trees in dynamic mapsbased on the dynamic planar graph algorithms of Eppstein et al [7] We will later show how to improve thetime bounds for this scheme at the expense of some additionalcomplexity

Theorem 1 Let M be a map with distinct edge weights changing according to the update operationsdescribed in the previous section as well as by changes to theweights of the edges Then in timeO(g logn)per update we can maintain a tree-cotree decomposition(T C X) where T is the minimum spanning treeC is the maximum spanning cotree and g is the genus of the map at the time of the update operation

Proof We representT by Sleator and Tarjanrsquos dynamic tree data structure [15] modified as in [7] to supportedge contraction and expansion operations as well as the more usual edge insertions and deletions We use asimilar data structure to represent the dual treeClowast With this data structure we can find in logarithmic timethe longest edge on any path ofT or the shortest edge on any path ofClowast We can also test in logarithmic timewhether a pair of edgese eprime forms aswap that is whetherTe eprime (where denotes the set-theoreticsymmetric difference) is another spanning tree ofT We also maintain the tree data structures discussed inSection 2 for the adjacency lists of each vertex and face ofM which allow us to classify the type of aninsertion or deletion in logarithmic time

To increase the weight of an edgee in T cup X we first test whether the increased weight causes the edgeto move to the maximum cotreeC by finding the shortest edgeeprime on the dual path connecting the endpointsof elowast and testing whether the dual swape eprime increases the weight ofC If so we adde to C and moveeprime

to X We then searchX for the minimum weight edgeeprimeprime forming a swape eprimeprime in T and testing whetherthis swap causes an improvement in the weight ofT If it does we addeprimeprime to T and movee to X Lemma 1shows that after these steps we must again have a tree-cotree partition To decrease the weight of an edgeein Ccup X we perform a similar sequence of steps on the dual tree-cotree-partition(Clowast Tlowast Xlowast)

We now describe the effect on our data structure of the various insertion and deletion operations Theedge expansions and contractions are performed by very similar sequences of steps in the dual map

ndash To perform a cell-merging insertion of an edgee we find the lightest edgeeprime on the dual path inClowast

connecting the merged cells and place botheandeprime in X We then perform swaps similar to those for a

7

weight change to determine whethere should move intoT or C To perform a cell-splitting deletion ofe we searchX for the heaviest edgeeprime connecting the two components ofClowast formed by the split andmoveeprime into C

ndash To perform a cell-splitting insertion of an edgee we adde to X searchX for the heaviest edgeeprime

connecting the two components ofClowast formed by the split and perform swaps similar to those for aweight change to determine whether to movee into T or C To perform a cell-merging deletion ofewe increase the weight ofe until it belongs toC then remove it from the graph and merge its two dualendpoints

ndash To perform a cell-twisting insertion of an edgee we simply adde to X search for the best swape eprimewith eprime isin T and perform this swap if it improves the weight ofT The inserted edgeecan not belong toC sinceelowast connects a dual vertex to itself To perform an untwisting deletion we test whetherebelongsto T and if so swap it with the best replacementeprime isin X before removing it

Each of these operations maintains the desired partition via a sequence ofO(g) dynamic tree queriesand updates so the total time per change toM isO(g logn) ⊓⊔

If we wish to maintain a tree-cotree decomposition of a graphwithout weights we can choose weightsfor the edges arbitrarily

43 Improved Dynamic Generators

The bottleneck of Theorem 1 is the search for swaps in graphsT cup X or Clowast cup Xlowast performing this search bytesting each edge inXlowast takes timeO(g logn) We can improve this by using the method of separator basedsparsification [6] to replaceT andClowast by contracted treesTprime andCprime that match theO(g) size ofX and thenapplying a general dynamic graph connectivity algorithm [12 18] to find the swaps in the smaller graphsTprime cup X or Cprime cup Xlowast

Specifically we formTprime from T by repeated edge contractions forming a sequence of treesT0 =T T1 Tk = Tprime If Ti contains a vertex with degree one that is not an endpoint of anedge inX wedelete that vertex and its adjacent edge to formTi+1 Otherwise ifTi contains a vertex with degree two thatis not an endpoint of an edge inX let e andeprime be the two edges incident to that vertex we formTi+1 bycontracting whichever ofe andeprime has the smaller weight The construction ofCprime from Clowast is essentially thesame except that we contract the larger weight of two edges incident to any degree two vertex

Lemma 3 The trees Tprime and Cprime described above haveO(|X|) edges and do not depend on the order inwhich the contractions are performed

Proof Consider the set of paths inT connecting endpoints ofX The union of these paths forms a subtreeTprimeprime

of T Then an alternative description ofTprime is that it consists of one edge for each path of degree-two verticesin Tprimeprime with the weight of this edge equal to the maximum weight of anedge in the path Specifically eachdeletion of a degree one vertex removes an edge that is not inTprimeprime and each contraction of a degree twovertex reduces the length of one of the paths inTprimeprime without changing the maximum weight of an edge on thepath This proves the assertion thatTprime is independent of the contraction order it hasO(|X|) edges becauseit has at most|X| leaves and no internal degree-two vertices ⊓⊔

Lemma 4 Trees Tprime and Cprime can be updated after any change to T or Clowast in timeO(logn) per change Eachchange to T C or X causesO(1) edges to change in Tprime and Cprime

Proof We use the following data structures forT First we use a dynamic tree data structure [15] that canfind the maximum weight edge on any path ofT and that can determine for any three query vertices ofT

8

which vertex forms the branching point between the paths connecting the three vertex Second we maintainan Euler tour data structure [11] that can find for a query vertex in T the one or two nearest vertices thatbelong toTprime Whenever a change toX adds a vertexv to the set of endpoints inX we must also addvto Tprime we do this by querying the Euler tour data structure to find the edge or vertex ofTprime at which thebranch tov should be added querying the dynamic tree data structure tofind the correct branching point onthat edge giving the overall graph structure of the new treeTprime and finally querying the dynamic tree datastructure again to find the weights of the changed edges inTprime To remove a vertex from the endpoints inXwe simply contract one or two edges as necessary inTprime To perform a swap inT we use the data structuresas described above to make all swap endpoints part ofTprime perform the swap and then contract edges toremove unnecessary vertices from the changedTprime The updates toCprime are similar ⊓⊔

Lemma 5 Let e be an edge of T that was not contracted in forming Tprime and let eprime be an edge of X Thene eprime is a swap in T if and only if it is a swap in Tprime

Lemma 6 Let eprime be an edge in X and let e be the heaviest edge forming a swape eprime in T Then e is notcontracted in forming Tprime

Theorem 2 Let M be a map with distinct edge weights changing according to the update operationsdescribed in the previous section as well as by changes to theweights of the edges Then in amortizedtimeO(logn + (logg)4) per update we can maintain a tree-cotree decomposition(T C X) where T is theminimum spanning tree C is the maximum spanning cotree andg is the genus of the map at the time of theupdate operation

Proof The overall algorithm is the same as the one in Theorem 1 but we use the data structures describedabove to maintain treesTprime andCprime and use the dynamic minimum spanning tree data structure ofHolm etal [12] to find the edgeeprime isin X forming the best swap for any edgeeisin T or elowast isin Clowast The time bound followsfrom plugging theO(|X|) bound on the number of edges inTprime cup X andCprime cup Xlowast into the time bound forthe minimum spanning tree data structure and using this bound to replace theO(g logn) time for findingreplacement edges in Theorem 1 ⊓⊔

The final improvement to our bounds comes from the observation that if we only wish to maintain atree-cotree decomposition for a graph without weights then we can replace the dynamic minimum spanningtree data structures forTprime cup X andCprime cup X with any dynamic connectivity data structure that maintains aspanning tree of these two dynamic graphs and changes the tree by a single swap per update to the graphsThe connectivity structure of Holm et al [12] as improved byThorup [18] is a suitable replacement

Theorem 3 Let M be a map with distinct edge weights changing according to the update operationsdescribed in the previous section as well as by changes to theweights of the edges Then in amortized timeO(logn + logg(log logg)3) per update we can maintain a tree-cotree decomposition(T C X) where g isthe genus of the map at the time of the update operation

44 Orientability

The results above are nearly sufficient to determine the surface underlying the dynamic mapM since itis known that 2-dimensional closed surfaces are classified by two quantities their genus (which we cancalculate from|X|) and theorientability of the surface We can compute the orientability from the followingsimple result which follows from the fact that the loops generated by edges inX form a cutset

9

Lemma 7 LetM have a tree-cotree decomposition(T C X) Then The surface on whichM is embeddedis unorientable if and only if every sufficiently small neighborhood of at least one of the loopsloop(T e) |eisin X is homeomorphic to a Mobius strip

Theorem 4 Let M be a map with distinct edge weights changing according to the update operationsdescribed in the previous section as well as by changes to theweights of the edges Then in amortized timeO(logn+ logg(log logg)3) per update we can determine after each update whether the surface underlyingthe map is orientable

Proof For any path inM we can form a sufficiently small neighborhood of the path by gluing togethera collection of disks where each disk has as its boundary thegem cycle representing a vertex or edge inthe path We choose an arbitrary clockwise orientation for the gem cycle representing each vertex inMand augment the Sleator-Tarjan dynamic tree data structureused to maintain the treeT in the tree-cotreedecomposition(T C X) by storing an extra bit per tree edge that is zero when the edgersquos preserves thechosen orientations of its two endpoints and one when it reverses these orientations we can use the dynamictree data structure to determine the parity of the sum of these bits along any path inT After each changeto the tree-cotree decomposition we use this data structure to determine whether anye isin X forms a loopwith odd total parity (including the parity ofe itself) If any odd loop is found the map is unorientable ifall loops are even the map is orientable ⊓⊔

5 Separator Theorems

Since Lipton and Tarjanrsquos discovery of the planar separatortheorem [14] separator theorems have becomewidely used in algorithms and there has been much work on improved constants for these theorems For-mally we define anǫ-separator of ann-vertex graphG to be a subsetSof the vertices ofG such that eachconnected component ofGShas at mostǫn vertices For graphs embedded on a genus-g orientable surfaceAleksandrov and Djidjev [1] showed that there always existsanǫ-separator with|S| le

radic

(16g + O(1ǫ))nWe combine our tree-cotree decomposition idea with the Lipton-Tarjan method of partitioning the breadthfirst search tree into levels (also used by Aleksandrov and Djidjev) to improve this result and extend it tounorientable surfaces

By Eulerrsquos formula if(T C X) is a tree-cotree decomposition of a map on an orientable surface then|X| = 2g whereg is the genus of the surface on whichM is embedded If the surface is unorientablethen |X| = g Because of this confusion between orientable and unorientable surfaces we prefer to usetheEuler characteristicχ(M) = |X| minus 2 in stating our results In terms ofχ Aleksandrov and Djidjevrsquosresult is that there exists a separator with|S| le

radic

(8χ + O(1ǫ))n We improve this by a factor ofradic

2 to|S| le

radic

(4χ + O(1ǫ))nLet T be a breadth first search tree of the given graph and form a tree-cotree decomposition(T C X)

For any pair of integers 0le i lt k define vertex setsLik andSik as followsLik consists of all verticesvwhose depthd(v) in T satisfiesd(v) equiv i (mod k) Sik is formed by adding toLik a pathPik(v) for eachendpointv of an edge inX wherePik(v) sub T connectsv to the first member ofLik on the path fromv tothe root ofT

Lemma 8 For any i and k G Sik is planar

Proof Extend the depth function on vertices to a continuous function λ M 7rarr R that maps each vertexto its depth maps each edge ofG one-to-one onto the interval between the depths of its endpoints andmaps each cell ofM in such a way that the map has no local minima or maxima in the interior of thecell Partition the surface underlying the mapM into submanifolds with boundary by removing all points

10

x for which λ(x) = i mod k Then each submanifold is formed fromM by cutting certain curves at depthλ(x) = i + ak (for some integera) and certain other curves at depthλ(x) = i + (a+ 1)k If we cap off thesecut curves with disks we form a manifoldMa without boundary Within each of the added disks at depthλ(x) = i + ak add a vertex connected by edges to all the vertices on the boundary of the disk the result isa graphGa embedded inMa such that each edge and vertex inGSik belongs to exactly one of the graphsGa If we let Ta be formed from the union ofT cap Ga with the newly added edges inGa thenTa is a forestdisjoint from the coforestC cap Ga so we can extend these two subgraphs to a tree-cotree decomposition(Tprime

a Cprimea Xprime

a) such thatXprimea sub XcapGa Therefore the pathsPik(v) for v an endpoint of an edge inXcapGa form

a cutset forMa andSik is a cutset for all ofM ⊓⊔

Lemma 9 For any k and any map embedded on a surface with Euler characteristic χsum

0leiltk

|Sik| le n + (χ + 2)k(kminus 1)

Proof Each vertex of the map belongs to exactly one graphLik In addition each of the 2(χ+ 2) endpointsv of edges inX contributes

sum |Pik(v)| =sum

0leiltk i vertices to the total Some vertices may be in more thanone pathPik(v) but this only reduces the total ⊓⊔

Theorem 5 Any n-vertex graph G embedded on a surface with Euler characteristic χ has anǫ-separatorwith |S| le

radic

(4χ + O(1ǫ))n vertices

Proof By choosingi minimizing |Sik| we achieve|Sik| le nk+χk+O(k) The result follows by choosingk =

radic

nχ applying a planar separator theorem to the planar graphG Sik and forming the union of theplanar separator withSik ⊓⊔

If a map representing a characteristic-χ embedding ofG is given as input the method described in theproof of the theorem can be implemented to run in time linear in the size of the map and produces a cutsetof size at most

radic

(4χ + O(1))n The time bound for the overall algorithm and the constant factor in theradic

O(nǫ) term in the separator size depend on the choice of planar separator algorithm used to completethe separator construction

We note that not all loops need always be incorporated inSik in order to makeG Sik planar Forinstance ifG is embedded on a torus it can be cut into a planar graph in the form of a cylinder by removingonly one of the two loops In addition if we chooseSik in such a way that some of the subgraphsTa andC cap Ga described in the proof of Lemma 8 are disconnected then additional edges are removed fromX informing the tree-cotree decompositions ofMa and again we can reduce the number of loops Can we usethese observations to further reduce the constant factor inour separator theorem

6 Low-Diameter Tree Decomposition

In previous work [5] we showed that in a minor-closed graph family the treewidth of a graph with diameterD can be bounded by a function ofD if and only if the family excludes some apex graph For instance forplanar graphs (which exclude the apex graphK5) the treewidth is at most 3D minus O(1) [2] Suchboundedlocal treewidthresults can be used to find efficient solutions to many important algorithmic problems onthese graphs [2459]

In particular any graph embedded on a genusg = O(1) surface has bounded local treewidth since thefamily of such graphs is minor-closed and excludes an apex graph However the treewidth bound from thisgeneral result grows rapidly withg and in this special case we were able to prove a tighter bound

11

Theorem 6 (Eppstein [5])Let G have genus g and diameter D Then G has treewidthO(gD)

The proof relies on showing the existence of a cutset of sizeO(gD) and forming a tree-decompositionby adding this cutset to each node in a tree-decomposition ofthe remaining planar graph However one stepin the proof is to find the minimum cardinality cutset so the proof is nonconstructive and Erickson andSar-Peled [8] later showed that in fact finding minimum cutsets is NP-complete By replacing this step withmethods based on our tree-cotree decomposition we can turnthis nonconstructive proof into an efficientalgorithm

Theorem 7 Let G have genus g and diameter D and suppose that we are givenas input an embeddingMof G on a surface of genus g Then in timeO(gDn) we can find a tree-decomposition of G with treewidthO(gD)

Proof We form a tree-decomposition(T C X) by lettingT be a breadth-first spanning tree ofG and lettingC be any spanning cotree disjoint fromT We then letSbe the set of vertices incident to the edges in loopsloop(T e) | eisin X Each loop has at most 2D edges so|S| = O(gD) andG S is planar so it has a tree-decomposition of treewidth 3DminusO(1) that can be found in timeO(Dn) [2] We form a tree-decompositionof G by addingS to each node in the tree-decomposition ofG S ⊓⊔

TheO(gDn) time bound is optimal in the sense that it is the size of an explicit representation of theresulting tree-decomposition but if we represent the setsof vertices at each tree-decomposition node im-plicitly as a union of a constant number of paths in the two treesT andB the time can be reduced to linearin the size of the input mapM

7 Conclusions

We have shown how the tree-cotree decomposition can be used in several applications for graphs embeddedon surfaces maintaining dynamic properties of the graph computing separators and constructing tree-decompositions of small treewidth There are many other important planar graph algorithms that can begeneralized to graphs embedded on surfaces and it would be interesting to see which others of these can beimproved by the use of our tree-cotree decomposition methods

Acknowledgements

This research was supported in part by NSF grant CCR-9912338

References

1 L Aleksandrov and H Djidjev Linear algorithms for partitioning embedded graphs of bounded genusSIAM J DiscreteMath9129ndash150 1996 httpwwwdcswarwickacuksimhristopapersgenus-separatorpsZ

2 B S Baker Approximation algorithms for NP-complete problems on planar graphsJ Assoc Comput Mach41153ndash1801994

3 C P Bonnington and C H C LittleThe Foundations of Topological Graph Theory Springer-Verlag 19954 D Eppstein Subgraph isomorphism in planar graphs and related problemsJ Graph Algorithms amp Applications3(3)1ndash27

1999 arXivcsDS99110035 D Eppstein Diameter and treewidth in minor-closed graph familiesAlgorithmica27275ndash291 2000

httplinkspringer-nycomlinkservicejournals00453contents0010020 arXivmathCO99071266 D Eppstein Z Galil G F Italiano and T H Spencer Separator based sparsification I planarity testing and minimum

spanning treesJ Computing amp Systems Sciences52(1)3ndash27 February 19967 D Eppstein G F Italiano R Tamassia R E Tarjan J R Westbrook and M Yung Maintenance of a minimum spanning

forest in a dynamic planar graphJ Algorithms13(1)33ndash54 March 1992

12

8 J Erickson and S Har-Peled Optimally cutting a surfaceinto a diskProc 18th ACM Symp Computational Geometrypp 244ndash253 June 2002 httpcompgeomcsuiucedusimjeffepubsschemahtml arXivcsCG0207004

9 M Grohe Local tree-width excluded minors and approximation algorithms arXivorg e-Print archive January 2000arXivmathCO0001128

10 J L Gross and T W TuckerTopological Graph Theory Dover Publications 200111 M R Henzinger and V King Randomized fully dynamic graph algorithms with polylogarithmic time per operationJ ACM

46(4)502ndash536 July 199912 J Holm K de Lichtenberg and M Thorup Poly-logarithmic deterministic fully-dynamic graph algorithms for connectivity

minimum spanning tree 2-edge and biconnectivityJ ACM48(4)723ndash760 July 200113 S Lins Graph-encoded mapsJ Combinatorial Theory Ser B32171ndash181 198214 R Lipton and R E Tarjan A separator theorem for planargraphsSIAM J Applied Math36(2)177ndash189 April 197915 D D Sleator and R E Tarjan A data structure for dynamic treesJ Computing amp Systems Sciences26362ndash391 198316 D A Spielman and S-H Teng Disk packings and planar separatorsProc 12th ACM Symp Computational Geometry

pp 349ndash358 1996 httpwww-mathmitedusimspielmanResearchseparatorhtml17 J StillwellClassical Topology and Combinatorial Group Theory Graduate Texts in Mathematics 72 Springer-Verlag 2nd

edition 199318 M Thorup Near-optimal fully-dynamic graph connectivity Proc 32nd ACM Symp Theory of Computing pp 343ndash350 May

200019 G Vegter and C-K Yap Computational complexity of combinatorial surfacesProc 6th ACM Symp Computational

Geometry pp 102ndash111 1990 httpwwwacmorgpubscitationsproceedingscompgeom98524p102-vegter

13

Page 2: Dynamic Generators of Topologically Embedded Graphs

ndash We provide a simple dynamic graph data structure for maintaining a dynamic graph embedded in a2-manifold subject to updates that insert or delete edgeschanging the ordering of edges around eachvertex and thus implicitly changing the underlying 2-manifold Our structure can also handle the dualoperations of edge contraction and expansion and maintains a set of generators for the fundamentalgroup of the surface as well as additional information suchas the minimum spanning tree of the graphor the orientability of the surface in amortized timeO(g logn) per update whereg is the genus of thesurface at the time of each update

ndash By combining our simple structure with ideas of separator based sparsification [6] and recent poly-logarithmic algorithms for dynamic connectivity in general graphs [12 18] we further improve ourtime bounds toO(logn + logg(log logg)3) per update for generators and orientability andO(logn +(logg)4) per update for minimum spanning trees

ndash We improve by a factor ofradic

2 the constant factor in the best previous separator theoremfor boundedgenus graphs [1]

ndash We provide an efficient algorithm for our previous nonconstructive result that genusg graphs withdiameterD have a tree-decomposition with treewidthO(gD) [5]

12 Related Work

The previous work most close to ours is on construction of canonical schemata and cutsetsA canonical schemafor a 2-manifold is a set of generators for its fundamental group having a single

prespecified relation (prod

g2ig2i+1gminus12i gminus1

2i+1 for oriented surfacesprod

g2i for unoriented surfaces) The genera-

tors must have a common basepoint but unlike the ones in our construction they are not required to followthe edges of a given graph on the surface they may pass acrossthe interior of cells Vegter and Yap [19]showed that canonical schemata exist with total complexityO(ng) whereg is the surface genus this boundis tight in the worst case and they also showed that a canonical schema can be found in timeO(ng) Thegenerators we find can have the sameΘ(gn) total complexity but we can find an implicit representationofthe generators in linear time However the generators we find are not necessarily in canonical form

Recently Erickson and Har-Peled [8] studied the problem offinding a cutset that is a set of edgesthe complement of which forms a topological disk on the givensurfaces Erickson and Har-Peled foundalgorithms for computing minimum-length cutsets in polynomial time for bounded-genus embeddings butshowed the problem to be NP-complete in the case of unboundedgenus In the applications to tree decom-position and separator theorems we use our techniques to find cutsets with a guaranteed bound on the totallength but our cutsets may be far from the minimum possible length

Planar separator theorems have been long studied [14] and there has been much work on improvedconstants for such theorems [16] More generally for graphs embedded on genusg surfaces a separatorwith O(

radicgn) vertices can be found inO(n) time [1] Specifically Aleksandrov and Djidjev [1] showed

that for anyǫ gt 0 one can find a set ofradic

(16g + O(1ǫ))n vertices the removal of which partitions thegraph into components of size at mostǫn Our techniques improve the constant factors in this result Wealso apply similar ideas to the computation of tree-decompositions for low-diameter low-genus graphs ourprevious work [5] proved the existence of such decompositions but did not provide an efficient algorithmfor finding them

The main inspiration for this paper was previous work on dynamic connectivity and minimum spanningtrees in embedded planar graphs [7] which worked by decomposing the graph into two subgraphs a min-imum spanning tree and a maximum spanning cotree We use a similar decomposition here however forsurfaces of nonzero genus we end up with leftover edges that belong neither to the tree nor to the cotreeThese extra edges are what we use to form the generators of thesurface We also combine the dynamic graphalgorithms from that previous work with a technique for maintaining small representative subgraphs [6] and

2

Fig 1 Left an embedding ofK33 in the projective plane The edges drawn crossing the dashedcircleconnect to the opposite side of the circle there is one hexagonal cell in the center surrounded by threequadrilaterals that form a Mobius strip Right a gem representation of the embedding The flags of theembedding are shown as triangles the dashed edges represent connections of typeSV the dotted edgesrepresent connections of typeSE and the solid edges represent connections of typeSC

more recent methods of Holm et al [12] to achieve time boundsthat match the best of these dynamic graphalgorithms

2 Representing an Embedding

We considermaps graphs embedded on two-dimensional manifolds in such a way that the cells of theembedding are disks We do not require that our graphs be simple Such an embedding on an orientablemanifold can be represented by specifying a clockwise ordering of the edges around each vertex [10 Sed-ction 324] However for our purposes it is convenient to use a somewhat more general representationthe graph-encoded map [3 13] which also allows unorientable embeddings We now briefly describe thisrepresentation

Suppose we are given a map such as the embedding ofK33 shown on the left of Figure 1 Aflag of themap is defined to be the triple formed by a mutually adjacent vertex edge and cell of the map For a flagFlet V(F) denote the vertexE(F) denote the edge andC(F) denote the cell We define three operations thatchange one flagF into another

ndash SV(F) is a flag formed by the edge and cell ofF but with a different vertex found at the other endpointof E(F)

ndash SE(F) is a flag formed by the vertex and cell ofF but with a different edge found by tracing around theboundary ofC(F) from E(F) in the direction ofV(F)

ndash SC(F) is a flag formed by the vertex and edge ofF but with a different cell the cell that is the next oneclockwise or counterclockwise aroundV(F) from C(F) in the direction ofE(F)

Each of these operations produces a unique well-defined flagand the neighboring relation betweenflags is symmetricSV(SV(F)) = SE(SE(F)) = SC(SC(F)) = F In a computer one can represent theseflags as objects in an object-oriented language and store with each flag a pointer or reference to its threetypes of neighbor Graphically we view the flags as verticesin a graph and the operations as unorientededges connecting each flag to its neighborsSV(F) SE(F) andSC(F) as shown on the right of Figure 1Although we see this gem as drawn in a projective plane the gem representation of an embedding is purely

3

graph-theoretic and independent of any drawing of the gem The edges of this graph should be viewed ashaving three colors representing the type of operation generating the edge in the figure these are shown asdashed dotted and solid respectively

For each vertex of the map withd adjacent edges the resulting gem has a 2d-cycle with edges alternatingbetween typesSE and SF For each edge of the map the gem has a quadrilateral with edges alternatingbetween typesSV andSC And for eachk-gon cell of the map the gem has a 2k-cycle with edges alternatingbetween typesSV andSE In this way every map generates a 3-regular 3-edge-colored graph in which theSV-SC cycles all have four edges Conversely given any such graph we can recover the original map byforming ak-gon cell for each 2k-cycle of edges of typesSV andSE and by gluing these cells together into amanifold whenever the corresponding edges of typesSV are part of a four-cycle of typesSV andSC

Any mapM has adual mapMlowast on the same surface formed by creating a dual vertexf lowast within eachfacef of the primal map and creating a dual edgeelowast for every primal edgee so that ife is adjacent to twofacesf1 andf2 thenelowast connectsf lowast1 andf lowast2 by a path that crossese once and crosses no other primal or dualedge In the gem representation the dual can be formed very simply by reversing the roles of the gem edgesof typesSV andSC

In our dynamic graph data structures we will augment the gemrepresentation by balanced binary treesfor the cycles corresponding to each vertex and cell of the map in this way we can quickly look up whichvertexrsquos or cellrsquos cycle contains a given edge of the gem andwhether two edges on the same cycle are in thesame or opposite orientations around the cycle

3 Trees and Generators

A spanning treeof a graph or map is just a tree formed by some subset of the edges of the graph thatincorporates all the vertices of the graph IfClowast is a spanning tree of the dual of a map we callC = e | elowast isinClowast a spanning cotreeof the map If the edges of a map are given weights the weight of a tree or cotree isdefined to be the sum of the weights of its edges

Lemma 1 Let a mapM be given with distinct weights on each of its edges Then theminimum weightspanning tree ofM and the maximum weight spanning cotree ofM are disjoint

Proof Let ebe an edge in the minimum spanning tree ofM Then removinge from the minimum spanningtree results in a forestF with two connected components letF1 be one of those components Then thesequence of faces ofM surroundingF1 forms a (possibly non-simple) cycle inMlowast consisting of the dualsof all edges connectingF1 to F2 Sincee belongs to the minimum spanning treeelowast must be the shortestedge in this dual cycle and so cannot belong to the maximum spanning tree ofMlowast ⊓⊔

In the special case of planar graphs the minimum spanning tree and maximum spanning cotree forma partition of all the edges of the graph [7] We define atree-cotree partitionof M to be a triple(T C X)whereT is a spanning tree ofM C is a spanning cotree ofM and the three setsT C andX are disjointand together include all edges ofM In particular ifT is the minimum spanning tree andC is the maxi-mum spanning cotree then(T C E(M) (T cup C)) is a tree-cotree decomposition By assigning weightsappropriately we can use Lemma 1 to find a tree-cotree decomposition involving any given treeT or cotreeC More generally ifT andClowast are forests such thatT andC are disjoint we can assign weights to makeTbecome part of the minimum spanning tree andC become part of the maximum spanning cotree extendingT andC to a tree-cotree decomposition

We now show how these decompositions are connected to fundamental groups of surfaces Thefunda-mental groupof a spaceS is most commonly defined relative to some base pointx0 isin S but for suitablespaces (including the 2-manifolds considered here) it is independent of the choice of this base point Definea loop to be a continuous functionf [0 1] 7rarr Ssatisfyingf (0) = f (1) = x0 and define two loopsf0 andf1

4

to behomotopy equivalentif there exists a continuous functionf [0 1]2 7rarr Ssuch thatf (x i) = fi(x) andf (0 i) = f (1 i) = x0 Define theproductof two loopsf0 andf1 to be the loop

f (x) =

f0(2x) for 0 le x le 12f1(2xminus 1) for 12 le x le 1

Then it can be shown that homotopy equivalence is an equivalence relation and that the homotopy equiv-alence classes of loops form a group thefundamental group under homotopy equivalence In this groupinverses can be found by reversing the direction of a loop iff is a loopg(x) = f (1minus x) is a loop inverse tof A set of loops is said togeneratethe fundamental group if every other equivalence class of loops can bereached by products of these generators and their inverses

If we are given a rooted treeT and oriented edgee isin T with the base pointx0 of the fundamental loopat the root ofT we can define a loop loop(T e) by following a path inT from x0 to the head ofe thentraversing edgee to its tail and finally following a path inT from that tail back tox0 When consideringthese loops as generators of the fundamental group the orientation ofe is unimportant since reversing theedge merely produces the inverse group element

Lemma 2 Let (T C X) be a tree-cotree decomposition of mapM Then the loopsloop(T e) | e isin Xgenerate the fundamental group of the surface on whichM is embedded

Proof Contract the edges inT into the rootx0 of T while leaving the surface unchanged outside of a smallneighborhood ofT this contraction does not change the fundamental group of the surface In the contractedimage the loops from the statement of the lemma are each contracted into a single edge connectingx0 toitself Decompose the surface into a setS1 consisting of a small neighborhood of the set of these contractedloops and a setS2 consisting of the faces of the map and the cotree edges inC Then by the Seifert ndash VanKampen theorem [17 Section 34] the fundamental group of the overall surface can be formed by combiningthe generators and relations of the fundamental groups of these two pieces with additional relations describ-ing the way these two pieces fit togetherS1 can be contracted to a graph with one vertex and|X| self-loopswhich has a fundamental group with each of these loops as generators and no relationsS2 is topologicallya disk (since it consists of a collection of disk faces glued together in the pattern of a tree) so it has a trivialfundamental group The fundamental group of the overall surface then is generated by the loops describedin the statement of the lemma with a single relation formed by the concatenation of these loops around theboundary ofS2 ⊓⊔

Of course for any treeT the loopsloop(T e) | e isin T also generate the fundamental group butin general this will form a much larger system of generatorsThe advantage of the system of generatorsprovided by Lemma 2 is its small cardinality proportional to the genus of the surface

The same tree-contraction argument used in Lemma 2 also shows that the edges in the loopsloop(T e) |eisin X form a cutset

4 Dynamic Generators

41 Update Operations

Following [7] we allow four types of update operation insertion of a new edge between two verticesdeletion of an edge dual edge insertion (expansion) and dual edge deletion (contraction) The effect ofthese updates on the gem representation is shown in Figure 2

The location of an edge insertion can be specified by a pair of gem verticesp andq shown as shadedtriangles in the figure We then subdivide the two gem edgesSE(p) andSE(q) into paths ofSE andSC edgespreserving the connectivity of theSE-SC cycles representing vertices in the gem and create a new graph

5

Fig 2 Effects of edge insertion and deletion and their duals on thegem representation

edge (represented in the gem by a 4-cycle ofSV andSC edges) using theSC edges of the subdivided pathsin such a way that the new gem edgesSE(p) andSE(q) are adjacent to a common edge of typeSV

In the most typical case of an edge insertion (Fig 2 upper right) the two edgesSE(p) andSE(q) aredistinct each of these edges is subdivided into a three-edge path and the two new vertices on each path areconnected in pairs by newSV edges We distinguish three subcases of this operation depending on whichcells of the map contain the endpoints of the inserted edge

ndash In a cell-merging insertion the two endpoints of the inserted edge are attached into distinct cells ofthe map that is the two gem edgesSE(p) andSE(q) belong to distinctSE-SV cycles The effect of theinsertion is to split each of these two cycles into paths andto splice these two paths together into asingle cycle via the newly createdSV edges We are increasing the number of edges and decreasing thenumber of cells so the surfacersquos genus increases Topologically this can be viewed as gluing a handlebetween the two cells and routing the new edge along this handle

ndash In acell-splitting insertion the two endpoints of the inserted edge belong to a single cell of the map andif the SE-SV cycle representing this cell is consistently oriented then SE(p) andSE(q) both point towardsor both point away from their endpointsp andq respectively The effect of the insertion is to split theSE-SV cycle into two paths and then reconnect the paths into two cycles forming two cells connectedacross the new edge We are increasing both the number of edges and the number of cells so the genusand the topology of the surface are preserved This was the only type of edge insertion allowed in [7]

ndash In acell-twisting insertion the two endpoints of the inserted edge belong to a single cell of the map butSE(p) andSE(q) are not consistently oriented The effect of the insertion is to split theSE-SV cycle intotwo paths and then reconnect the paths into a single cycle with the orientation of the two paths reversedfrom their previous situation We are increasing the numberof edges while preserving the number ofcells so the genus increases Topologically this can be viewed as gluing a crosscap into the cell androuting the new edge through it

Each of these types of insertion has a complementary deletion specified by the edge to be deleted whichwe call acell-splitting deletion acell-merging deletion or anuntwisting deletionrespectively In addition

6

we allow the dual operations to insertions and deletions asshown on the upper right of the figure dualdeletion is more familiar as the operation of edge contraction The dual of a cell-merging insertion mergestwo vertices of the graph while increasing the genus the dual of a cell-splitting insertion splits a vertexinto two adjacent vertices and the dual of a cell-twisting insertion changes the order of the edges and cellsaround a vertex We do not describe these in detail because our data structure will be self-dual so that eachdual operation is performed exactly as the primal operationsubstitutingSV for SC and vice versa

Finally it is possible to specify an insertion in whichSE(p) andSE(q) are not distinct Ifp 6= q whileSE(p) = SE(q) (Fig 2 lower left) we subdivideSE into a path of five edges and connect the four new gemvertices into anSV-SC cycle in such a way that adjacent vertices of the cycle are connected top andq Thiscan be viewed as a special case of a cell-splitting insertionin which the two endpoints of the inserted edgeare placed next to each other at the same vertex creating a one-sided cell contained within the previouslyexisting cell The dual of this operation adds a new degree-one vertex to the graph

If p = q we perform an edge insertion by again subdividingSE into a path of five edges and connectingthe four new gem vertices into anSV-SC cycle in such a way that opposite vertices of the cycle are connectedto p and the other endpoint ofSE(p) Edge insertion withp = q and dual edge insertion withp = q producethe same result shown in the lower right of Fig 2 This can beviewed as a special case of a cell-twistinginsertion in which the two endpoints of the inserted edge areplaced next to each other at the same vertex

42 Simple Dynamic Generators

We now describe a simple scheme for maintaining generators and minimum spanning trees in dynamic mapsbased on the dynamic planar graph algorithms of Eppstein et al [7] We will later show how to improve thetime bounds for this scheme at the expense of some additionalcomplexity

Theorem 1 Let M be a map with distinct edge weights changing according to the update operationsdescribed in the previous section as well as by changes to theweights of the edges Then in timeO(g logn)per update we can maintain a tree-cotree decomposition(T C X) where T is the minimum spanning treeC is the maximum spanning cotree and g is the genus of the map at the time of the update operation

Proof We representT by Sleator and Tarjanrsquos dynamic tree data structure [15] modified as in [7] to supportedge contraction and expansion operations as well as the more usual edge insertions and deletions We use asimilar data structure to represent the dual treeClowast With this data structure we can find in logarithmic timethe longest edge on any path ofT or the shortest edge on any path ofClowast We can also test in logarithmic timewhether a pair of edgese eprime forms aswap that is whetherTe eprime (where denotes the set-theoreticsymmetric difference) is another spanning tree ofT We also maintain the tree data structures discussed inSection 2 for the adjacency lists of each vertex and face ofM which allow us to classify the type of aninsertion or deletion in logarithmic time

To increase the weight of an edgee in T cup X we first test whether the increased weight causes the edgeto move to the maximum cotreeC by finding the shortest edgeeprime on the dual path connecting the endpointsof elowast and testing whether the dual swape eprime increases the weight ofC If so we adde to C and moveeprime

to X We then searchX for the minimum weight edgeeprimeprime forming a swape eprimeprime in T and testing whetherthis swap causes an improvement in the weight ofT If it does we addeprimeprime to T and movee to X Lemma 1shows that after these steps we must again have a tree-cotree partition To decrease the weight of an edgeein Ccup X we perform a similar sequence of steps on the dual tree-cotree-partition(Clowast Tlowast Xlowast)

We now describe the effect on our data structure of the various insertion and deletion operations Theedge expansions and contractions are performed by very similar sequences of steps in the dual map

ndash To perform a cell-merging insertion of an edgee we find the lightest edgeeprime on the dual path inClowast

connecting the merged cells and place botheandeprime in X We then perform swaps similar to those for a

7

weight change to determine whethere should move intoT or C To perform a cell-splitting deletion ofe we searchX for the heaviest edgeeprime connecting the two components ofClowast formed by the split andmoveeprime into C

ndash To perform a cell-splitting insertion of an edgee we adde to X searchX for the heaviest edgeeprime

connecting the two components ofClowast formed by the split and perform swaps similar to those for aweight change to determine whether to movee into T or C To perform a cell-merging deletion ofewe increase the weight ofe until it belongs toC then remove it from the graph and merge its two dualendpoints

ndash To perform a cell-twisting insertion of an edgee we simply adde to X search for the best swape eprimewith eprime isin T and perform this swap if it improves the weight ofT The inserted edgeecan not belong toC sinceelowast connects a dual vertex to itself To perform an untwisting deletion we test whetherebelongsto T and if so swap it with the best replacementeprime isin X before removing it

Each of these operations maintains the desired partition via a sequence ofO(g) dynamic tree queriesand updates so the total time per change toM isO(g logn) ⊓⊔

If we wish to maintain a tree-cotree decomposition of a graphwithout weights we can choose weightsfor the edges arbitrarily

43 Improved Dynamic Generators

The bottleneck of Theorem 1 is the search for swaps in graphsT cup X or Clowast cup Xlowast performing this search bytesting each edge inXlowast takes timeO(g logn) We can improve this by using the method of separator basedsparsification [6] to replaceT andClowast by contracted treesTprime andCprime that match theO(g) size ofX and thenapplying a general dynamic graph connectivity algorithm [12 18] to find the swaps in the smaller graphsTprime cup X or Cprime cup Xlowast

Specifically we formTprime from T by repeated edge contractions forming a sequence of treesT0 =T T1 Tk = Tprime If Ti contains a vertex with degree one that is not an endpoint of anedge inX wedelete that vertex and its adjacent edge to formTi+1 Otherwise ifTi contains a vertex with degree two thatis not an endpoint of an edge inX let e andeprime be the two edges incident to that vertex we formTi+1 bycontracting whichever ofe andeprime has the smaller weight The construction ofCprime from Clowast is essentially thesame except that we contract the larger weight of two edges incident to any degree two vertex

Lemma 3 The trees Tprime and Cprime described above haveO(|X|) edges and do not depend on the order inwhich the contractions are performed

Proof Consider the set of paths inT connecting endpoints ofX The union of these paths forms a subtreeTprimeprime

of T Then an alternative description ofTprime is that it consists of one edge for each path of degree-two verticesin Tprimeprime with the weight of this edge equal to the maximum weight of anedge in the path Specifically eachdeletion of a degree one vertex removes an edge that is not inTprimeprime and each contraction of a degree twovertex reduces the length of one of the paths inTprimeprime without changing the maximum weight of an edge on thepath This proves the assertion thatTprime is independent of the contraction order it hasO(|X|) edges becauseit has at most|X| leaves and no internal degree-two vertices ⊓⊔

Lemma 4 Trees Tprime and Cprime can be updated after any change to T or Clowast in timeO(logn) per change Eachchange to T C or X causesO(1) edges to change in Tprime and Cprime

Proof We use the following data structures forT First we use a dynamic tree data structure [15] that canfind the maximum weight edge on any path ofT and that can determine for any three query vertices ofT

8

which vertex forms the branching point between the paths connecting the three vertex Second we maintainan Euler tour data structure [11] that can find for a query vertex in T the one or two nearest vertices thatbelong toTprime Whenever a change toX adds a vertexv to the set of endpoints inX we must also addvto Tprime we do this by querying the Euler tour data structure to find the edge or vertex ofTprime at which thebranch tov should be added querying the dynamic tree data structure tofind the correct branching point onthat edge giving the overall graph structure of the new treeTprime and finally querying the dynamic tree datastructure again to find the weights of the changed edges inTprime To remove a vertex from the endpoints inXwe simply contract one or two edges as necessary inTprime To perform a swap inT we use the data structuresas described above to make all swap endpoints part ofTprime perform the swap and then contract edges toremove unnecessary vertices from the changedTprime The updates toCprime are similar ⊓⊔

Lemma 5 Let e be an edge of T that was not contracted in forming Tprime and let eprime be an edge of X Thene eprime is a swap in T if and only if it is a swap in Tprime

Lemma 6 Let eprime be an edge in X and let e be the heaviest edge forming a swape eprime in T Then e is notcontracted in forming Tprime

Theorem 2 Let M be a map with distinct edge weights changing according to the update operationsdescribed in the previous section as well as by changes to theweights of the edges Then in amortizedtimeO(logn + (logg)4) per update we can maintain a tree-cotree decomposition(T C X) where T is theminimum spanning tree C is the maximum spanning cotree andg is the genus of the map at the time of theupdate operation

Proof The overall algorithm is the same as the one in Theorem 1 but we use the data structures describedabove to maintain treesTprime andCprime and use the dynamic minimum spanning tree data structure ofHolm etal [12] to find the edgeeprime isin X forming the best swap for any edgeeisin T or elowast isin Clowast The time bound followsfrom plugging theO(|X|) bound on the number of edges inTprime cup X andCprime cup Xlowast into the time bound forthe minimum spanning tree data structure and using this bound to replace theO(g logn) time for findingreplacement edges in Theorem 1 ⊓⊔

The final improvement to our bounds comes from the observation that if we only wish to maintain atree-cotree decomposition for a graph without weights then we can replace the dynamic minimum spanningtree data structures forTprime cup X andCprime cup X with any dynamic connectivity data structure that maintains aspanning tree of these two dynamic graphs and changes the tree by a single swap per update to the graphsThe connectivity structure of Holm et al [12] as improved byThorup [18] is a suitable replacement

Theorem 3 Let M be a map with distinct edge weights changing according to the update operationsdescribed in the previous section as well as by changes to theweights of the edges Then in amortized timeO(logn + logg(log logg)3) per update we can maintain a tree-cotree decomposition(T C X) where g isthe genus of the map at the time of the update operation

44 Orientability

The results above are nearly sufficient to determine the surface underlying the dynamic mapM since itis known that 2-dimensional closed surfaces are classified by two quantities their genus (which we cancalculate from|X|) and theorientability of the surface We can compute the orientability from the followingsimple result which follows from the fact that the loops generated by edges inX form a cutset

9

Lemma 7 LetM have a tree-cotree decomposition(T C X) Then The surface on whichM is embeddedis unorientable if and only if every sufficiently small neighborhood of at least one of the loopsloop(T e) |eisin X is homeomorphic to a Mobius strip

Theorem 4 Let M be a map with distinct edge weights changing according to the update operationsdescribed in the previous section as well as by changes to theweights of the edges Then in amortized timeO(logn+ logg(log logg)3) per update we can determine after each update whether the surface underlyingthe map is orientable

Proof For any path inM we can form a sufficiently small neighborhood of the path by gluing togethera collection of disks where each disk has as its boundary thegem cycle representing a vertex or edge inthe path We choose an arbitrary clockwise orientation for the gem cycle representing each vertex inMand augment the Sleator-Tarjan dynamic tree data structureused to maintain the treeT in the tree-cotreedecomposition(T C X) by storing an extra bit per tree edge that is zero when the edgersquos preserves thechosen orientations of its two endpoints and one when it reverses these orientations we can use the dynamictree data structure to determine the parity of the sum of these bits along any path inT After each changeto the tree-cotree decomposition we use this data structure to determine whether anye isin X forms a loopwith odd total parity (including the parity ofe itself) If any odd loop is found the map is unorientable ifall loops are even the map is orientable ⊓⊔

5 Separator Theorems

Since Lipton and Tarjanrsquos discovery of the planar separatortheorem [14] separator theorems have becomewidely used in algorithms and there has been much work on improved constants for these theorems For-mally we define anǫ-separator of ann-vertex graphG to be a subsetSof the vertices ofG such that eachconnected component ofGShas at mostǫn vertices For graphs embedded on a genus-g orientable surfaceAleksandrov and Djidjev [1] showed that there always existsanǫ-separator with|S| le

radic

(16g + O(1ǫ))nWe combine our tree-cotree decomposition idea with the Lipton-Tarjan method of partitioning the breadthfirst search tree into levels (also used by Aleksandrov and Djidjev) to improve this result and extend it tounorientable surfaces

By Eulerrsquos formula if(T C X) is a tree-cotree decomposition of a map on an orientable surface then|X| = 2g whereg is the genus of the surface on whichM is embedded If the surface is unorientablethen |X| = g Because of this confusion between orientable and unorientable surfaces we prefer to usetheEuler characteristicχ(M) = |X| minus 2 in stating our results In terms ofχ Aleksandrov and Djidjevrsquosresult is that there exists a separator with|S| le

radic

(8χ + O(1ǫ))n We improve this by a factor ofradic

2 to|S| le

radic

(4χ + O(1ǫ))nLet T be a breadth first search tree of the given graph and form a tree-cotree decomposition(T C X)

For any pair of integers 0le i lt k define vertex setsLik andSik as followsLik consists of all verticesvwhose depthd(v) in T satisfiesd(v) equiv i (mod k) Sik is formed by adding toLik a pathPik(v) for eachendpointv of an edge inX wherePik(v) sub T connectsv to the first member ofLik on the path fromv tothe root ofT

Lemma 8 For any i and k G Sik is planar

Proof Extend the depth function on vertices to a continuous function λ M 7rarr R that maps each vertexto its depth maps each edge ofG one-to-one onto the interval between the depths of its endpoints andmaps each cell ofM in such a way that the map has no local minima or maxima in the interior of thecell Partition the surface underlying the mapM into submanifolds with boundary by removing all points

10

x for which λ(x) = i mod k Then each submanifold is formed fromM by cutting certain curves at depthλ(x) = i + ak (for some integera) and certain other curves at depthλ(x) = i + (a+ 1)k If we cap off thesecut curves with disks we form a manifoldMa without boundary Within each of the added disks at depthλ(x) = i + ak add a vertex connected by edges to all the vertices on the boundary of the disk the result isa graphGa embedded inMa such that each edge and vertex inGSik belongs to exactly one of the graphsGa If we let Ta be formed from the union ofT cap Ga with the newly added edges inGa thenTa is a forestdisjoint from the coforestC cap Ga so we can extend these two subgraphs to a tree-cotree decomposition(Tprime

a Cprimea Xprime

a) such thatXprimea sub XcapGa Therefore the pathsPik(v) for v an endpoint of an edge inXcapGa form

a cutset forMa andSik is a cutset for all ofM ⊓⊔

Lemma 9 For any k and any map embedded on a surface with Euler characteristic χsum

0leiltk

|Sik| le n + (χ + 2)k(kminus 1)

Proof Each vertex of the map belongs to exactly one graphLik In addition each of the 2(χ+ 2) endpointsv of edges inX contributes

sum |Pik(v)| =sum

0leiltk i vertices to the total Some vertices may be in more thanone pathPik(v) but this only reduces the total ⊓⊔

Theorem 5 Any n-vertex graph G embedded on a surface with Euler characteristic χ has anǫ-separatorwith |S| le

radic

(4χ + O(1ǫ))n vertices

Proof By choosingi minimizing |Sik| we achieve|Sik| le nk+χk+O(k) The result follows by choosingk =

radic

nχ applying a planar separator theorem to the planar graphG Sik and forming the union of theplanar separator withSik ⊓⊔

If a map representing a characteristic-χ embedding ofG is given as input the method described in theproof of the theorem can be implemented to run in time linear in the size of the map and produces a cutsetof size at most

radic

(4χ + O(1))n The time bound for the overall algorithm and the constant factor in theradic

O(nǫ) term in the separator size depend on the choice of planar separator algorithm used to completethe separator construction

We note that not all loops need always be incorporated inSik in order to makeG Sik planar Forinstance ifG is embedded on a torus it can be cut into a planar graph in the form of a cylinder by removingonly one of the two loops In addition if we chooseSik in such a way that some of the subgraphsTa andC cap Ga described in the proof of Lemma 8 are disconnected then additional edges are removed fromX informing the tree-cotree decompositions ofMa and again we can reduce the number of loops Can we usethese observations to further reduce the constant factor inour separator theorem

6 Low-Diameter Tree Decomposition

In previous work [5] we showed that in a minor-closed graph family the treewidth of a graph with diameterD can be bounded by a function ofD if and only if the family excludes some apex graph For instance forplanar graphs (which exclude the apex graphK5) the treewidth is at most 3D minus O(1) [2] Suchboundedlocal treewidthresults can be used to find efficient solutions to many important algorithmic problems onthese graphs [2459]

In particular any graph embedded on a genusg = O(1) surface has bounded local treewidth since thefamily of such graphs is minor-closed and excludes an apex graph However the treewidth bound from thisgeneral result grows rapidly withg and in this special case we were able to prove a tighter bound

11

Theorem 6 (Eppstein [5])Let G have genus g and diameter D Then G has treewidthO(gD)

The proof relies on showing the existence of a cutset of sizeO(gD) and forming a tree-decompositionby adding this cutset to each node in a tree-decomposition ofthe remaining planar graph However one stepin the proof is to find the minimum cardinality cutset so the proof is nonconstructive and Erickson andSar-Peled [8] later showed that in fact finding minimum cutsets is NP-complete By replacing this step withmethods based on our tree-cotree decomposition we can turnthis nonconstructive proof into an efficientalgorithm

Theorem 7 Let G have genus g and diameter D and suppose that we are givenas input an embeddingMof G on a surface of genus g Then in timeO(gDn) we can find a tree-decomposition of G with treewidthO(gD)

Proof We form a tree-decomposition(T C X) by lettingT be a breadth-first spanning tree ofG and lettingC be any spanning cotree disjoint fromT We then letSbe the set of vertices incident to the edges in loopsloop(T e) | eisin X Each loop has at most 2D edges so|S| = O(gD) andG S is planar so it has a tree-decomposition of treewidth 3DminusO(1) that can be found in timeO(Dn) [2] We form a tree-decompositionof G by addingS to each node in the tree-decomposition ofG S ⊓⊔

TheO(gDn) time bound is optimal in the sense that it is the size of an explicit representation of theresulting tree-decomposition but if we represent the setsof vertices at each tree-decomposition node im-plicitly as a union of a constant number of paths in the two treesT andB the time can be reduced to linearin the size of the input mapM

7 Conclusions

We have shown how the tree-cotree decomposition can be used in several applications for graphs embeddedon surfaces maintaining dynamic properties of the graph computing separators and constructing tree-decompositions of small treewidth There are many other important planar graph algorithms that can begeneralized to graphs embedded on surfaces and it would be interesting to see which others of these can beimproved by the use of our tree-cotree decomposition methods

Acknowledgements

This research was supported in part by NSF grant CCR-9912338

References

1 L Aleksandrov and H Djidjev Linear algorithms for partitioning embedded graphs of bounded genusSIAM J DiscreteMath9129ndash150 1996 httpwwwdcswarwickacuksimhristopapersgenus-separatorpsZ

2 B S Baker Approximation algorithms for NP-complete problems on planar graphsJ Assoc Comput Mach41153ndash1801994

3 C P Bonnington and C H C LittleThe Foundations of Topological Graph Theory Springer-Verlag 19954 D Eppstein Subgraph isomorphism in planar graphs and related problemsJ Graph Algorithms amp Applications3(3)1ndash27

1999 arXivcsDS99110035 D Eppstein Diameter and treewidth in minor-closed graph familiesAlgorithmica27275ndash291 2000

httplinkspringer-nycomlinkservicejournals00453contents0010020 arXivmathCO99071266 D Eppstein Z Galil G F Italiano and T H Spencer Separator based sparsification I planarity testing and minimum

spanning treesJ Computing amp Systems Sciences52(1)3ndash27 February 19967 D Eppstein G F Italiano R Tamassia R E Tarjan J R Westbrook and M Yung Maintenance of a minimum spanning

forest in a dynamic planar graphJ Algorithms13(1)33ndash54 March 1992

12

8 J Erickson and S Har-Peled Optimally cutting a surfaceinto a diskProc 18th ACM Symp Computational Geometrypp 244ndash253 June 2002 httpcompgeomcsuiucedusimjeffepubsschemahtml arXivcsCG0207004

9 M Grohe Local tree-width excluded minors and approximation algorithms arXivorg e-Print archive January 2000arXivmathCO0001128

10 J L Gross and T W TuckerTopological Graph Theory Dover Publications 200111 M R Henzinger and V King Randomized fully dynamic graph algorithms with polylogarithmic time per operationJ ACM

46(4)502ndash536 July 199912 J Holm K de Lichtenberg and M Thorup Poly-logarithmic deterministic fully-dynamic graph algorithms for connectivity

minimum spanning tree 2-edge and biconnectivityJ ACM48(4)723ndash760 July 200113 S Lins Graph-encoded mapsJ Combinatorial Theory Ser B32171ndash181 198214 R Lipton and R E Tarjan A separator theorem for planargraphsSIAM J Applied Math36(2)177ndash189 April 197915 D D Sleator and R E Tarjan A data structure for dynamic treesJ Computing amp Systems Sciences26362ndash391 198316 D A Spielman and S-H Teng Disk packings and planar separatorsProc 12th ACM Symp Computational Geometry

pp 349ndash358 1996 httpwww-mathmitedusimspielmanResearchseparatorhtml17 J StillwellClassical Topology and Combinatorial Group Theory Graduate Texts in Mathematics 72 Springer-Verlag 2nd

edition 199318 M Thorup Near-optimal fully-dynamic graph connectivity Proc 32nd ACM Symp Theory of Computing pp 343ndash350 May

200019 G Vegter and C-K Yap Computational complexity of combinatorial surfacesProc 6th ACM Symp Computational

Geometry pp 102ndash111 1990 httpwwwacmorgpubscitationsproceedingscompgeom98524p102-vegter

13

Page 3: Dynamic Generators of Topologically Embedded Graphs

Fig 1 Left an embedding ofK33 in the projective plane The edges drawn crossing the dashedcircleconnect to the opposite side of the circle there is one hexagonal cell in the center surrounded by threequadrilaterals that form a Mobius strip Right a gem representation of the embedding The flags of theembedding are shown as triangles the dashed edges represent connections of typeSV the dotted edgesrepresent connections of typeSE and the solid edges represent connections of typeSC

more recent methods of Holm et al [12] to achieve time boundsthat match the best of these dynamic graphalgorithms

2 Representing an Embedding

We considermaps graphs embedded on two-dimensional manifolds in such a way that the cells of theembedding are disks We do not require that our graphs be simple Such an embedding on an orientablemanifold can be represented by specifying a clockwise ordering of the edges around each vertex [10 Sed-ction 324] However for our purposes it is convenient to use a somewhat more general representationthe graph-encoded map [3 13] which also allows unorientable embeddings We now briefly describe thisrepresentation

Suppose we are given a map such as the embedding ofK33 shown on the left of Figure 1 Aflag of themap is defined to be the triple formed by a mutually adjacent vertex edge and cell of the map For a flagFlet V(F) denote the vertexE(F) denote the edge andC(F) denote the cell We define three operations thatchange one flagF into another

ndash SV(F) is a flag formed by the edge and cell ofF but with a different vertex found at the other endpointof E(F)

ndash SE(F) is a flag formed by the vertex and cell ofF but with a different edge found by tracing around theboundary ofC(F) from E(F) in the direction ofV(F)

ndash SC(F) is a flag formed by the vertex and edge ofF but with a different cell the cell that is the next oneclockwise or counterclockwise aroundV(F) from C(F) in the direction ofE(F)

Each of these operations produces a unique well-defined flagand the neighboring relation betweenflags is symmetricSV(SV(F)) = SE(SE(F)) = SC(SC(F)) = F In a computer one can represent theseflags as objects in an object-oriented language and store with each flag a pointer or reference to its threetypes of neighbor Graphically we view the flags as verticesin a graph and the operations as unorientededges connecting each flag to its neighborsSV(F) SE(F) andSC(F) as shown on the right of Figure 1Although we see this gem as drawn in a projective plane the gem representation of an embedding is purely

3

graph-theoretic and independent of any drawing of the gem The edges of this graph should be viewed ashaving three colors representing the type of operation generating the edge in the figure these are shown asdashed dotted and solid respectively

For each vertex of the map withd adjacent edges the resulting gem has a 2d-cycle with edges alternatingbetween typesSE and SF For each edge of the map the gem has a quadrilateral with edges alternatingbetween typesSV andSC And for eachk-gon cell of the map the gem has a 2k-cycle with edges alternatingbetween typesSV andSE In this way every map generates a 3-regular 3-edge-colored graph in which theSV-SC cycles all have four edges Conversely given any such graph we can recover the original map byforming ak-gon cell for each 2k-cycle of edges of typesSV andSE and by gluing these cells together into amanifold whenever the corresponding edges of typesSV are part of a four-cycle of typesSV andSC

Any mapM has adual mapMlowast on the same surface formed by creating a dual vertexf lowast within eachfacef of the primal map and creating a dual edgeelowast for every primal edgee so that ife is adjacent to twofacesf1 andf2 thenelowast connectsf lowast1 andf lowast2 by a path that crossese once and crosses no other primal or dualedge In the gem representation the dual can be formed very simply by reversing the roles of the gem edgesof typesSV andSC

In our dynamic graph data structures we will augment the gemrepresentation by balanced binary treesfor the cycles corresponding to each vertex and cell of the map in this way we can quickly look up whichvertexrsquos or cellrsquos cycle contains a given edge of the gem andwhether two edges on the same cycle are in thesame or opposite orientations around the cycle

3 Trees and Generators

A spanning treeof a graph or map is just a tree formed by some subset of the edges of the graph thatincorporates all the vertices of the graph IfClowast is a spanning tree of the dual of a map we callC = e | elowast isinClowast a spanning cotreeof the map If the edges of a map are given weights the weight of a tree or cotree isdefined to be the sum of the weights of its edges

Lemma 1 Let a mapM be given with distinct weights on each of its edges Then theminimum weightspanning tree ofM and the maximum weight spanning cotree ofM are disjoint

Proof Let ebe an edge in the minimum spanning tree ofM Then removinge from the minimum spanningtree results in a forestF with two connected components letF1 be one of those components Then thesequence of faces ofM surroundingF1 forms a (possibly non-simple) cycle inMlowast consisting of the dualsof all edges connectingF1 to F2 Sincee belongs to the minimum spanning treeelowast must be the shortestedge in this dual cycle and so cannot belong to the maximum spanning tree ofMlowast ⊓⊔

In the special case of planar graphs the minimum spanning tree and maximum spanning cotree forma partition of all the edges of the graph [7] We define atree-cotree partitionof M to be a triple(T C X)whereT is a spanning tree ofM C is a spanning cotree ofM and the three setsT C andX are disjointand together include all edges ofM In particular ifT is the minimum spanning tree andC is the maxi-mum spanning cotree then(T C E(M) (T cup C)) is a tree-cotree decomposition By assigning weightsappropriately we can use Lemma 1 to find a tree-cotree decomposition involving any given treeT or cotreeC More generally ifT andClowast are forests such thatT andC are disjoint we can assign weights to makeTbecome part of the minimum spanning tree andC become part of the maximum spanning cotree extendingT andC to a tree-cotree decomposition

We now show how these decompositions are connected to fundamental groups of surfaces Thefunda-mental groupof a spaceS is most commonly defined relative to some base pointx0 isin S but for suitablespaces (including the 2-manifolds considered here) it is independent of the choice of this base point Definea loop to be a continuous functionf [0 1] 7rarr Ssatisfyingf (0) = f (1) = x0 and define two loopsf0 andf1

4

to behomotopy equivalentif there exists a continuous functionf [0 1]2 7rarr Ssuch thatf (x i) = fi(x) andf (0 i) = f (1 i) = x0 Define theproductof two loopsf0 andf1 to be the loop

f (x) =

f0(2x) for 0 le x le 12f1(2xminus 1) for 12 le x le 1

Then it can be shown that homotopy equivalence is an equivalence relation and that the homotopy equiv-alence classes of loops form a group thefundamental group under homotopy equivalence In this groupinverses can be found by reversing the direction of a loop iff is a loopg(x) = f (1minus x) is a loop inverse tof A set of loops is said togeneratethe fundamental group if every other equivalence class of loops can bereached by products of these generators and their inverses

If we are given a rooted treeT and oriented edgee isin T with the base pointx0 of the fundamental loopat the root ofT we can define a loop loop(T e) by following a path inT from x0 to the head ofe thentraversing edgee to its tail and finally following a path inT from that tail back tox0 When consideringthese loops as generators of the fundamental group the orientation ofe is unimportant since reversing theedge merely produces the inverse group element

Lemma 2 Let (T C X) be a tree-cotree decomposition of mapM Then the loopsloop(T e) | e isin Xgenerate the fundamental group of the surface on whichM is embedded

Proof Contract the edges inT into the rootx0 of T while leaving the surface unchanged outside of a smallneighborhood ofT this contraction does not change the fundamental group of the surface In the contractedimage the loops from the statement of the lemma are each contracted into a single edge connectingx0 toitself Decompose the surface into a setS1 consisting of a small neighborhood of the set of these contractedloops and a setS2 consisting of the faces of the map and the cotree edges inC Then by the Seifert ndash VanKampen theorem [17 Section 34] the fundamental group of the overall surface can be formed by combiningthe generators and relations of the fundamental groups of these two pieces with additional relations describ-ing the way these two pieces fit togetherS1 can be contracted to a graph with one vertex and|X| self-loopswhich has a fundamental group with each of these loops as generators and no relationsS2 is topologicallya disk (since it consists of a collection of disk faces glued together in the pattern of a tree) so it has a trivialfundamental group The fundamental group of the overall surface then is generated by the loops describedin the statement of the lemma with a single relation formed by the concatenation of these loops around theboundary ofS2 ⊓⊔

Of course for any treeT the loopsloop(T e) | e isin T also generate the fundamental group butin general this will form a much larger system of generatorsThe advantage of the system of generatorsprovided by Lemma 2 is its small cardinality proportional to the genus of the surface

The same tree-contraction argument used in Lemma 2 also shows that the edges in the loopsloop(T e) |eisin X form a cutset

4 Dynamic Generators

41 Update Operations

Following [7] we allow four types of update operation insertion of a new edge between two verticesdeletion of an edge dual edge insertion (expansion) and dual edge deletion (contraction) The effect ofthese updates on the gem representation is shown in Figure 2

The location of an edge insertion can be specified by a pair of gem verticesp andq shown as shadedtriangles in the figure We then subdivide the two gem edgesSE(p) andSE(q) into paths ofSE andSC edgespreserving the connectivity of theSE-SC cycles representing vertices in the gem and create a new graph

5

Fig 2 Effects of edge insertion and deletion and their duals on thegem representation

edge (represented in the gem by a 4-cycle ofSV andSC edges) using theSC edges of the subdivided pathsin such a way that the new gem edgesSE(p) andSE(q) are adjacent to a common edge of typeSV

In the most typical case of an edge insertion (Fig 2 upper right) the two edgesSE(p) andSE(q) aredistinct each of these edges is subdivided into a three-edge path and the two new vertices on each path areconnected in pairs by newSV edges We distinguish three subcases of this operation depending on whichcells of the map contain the endpoints of the inserted edge

ndash In a cell-merging insertion the two endpoints of the inserted edge are attached into distinct cells ofthe map that is the two gem edgesSE(p) andSE(q) belong to distinctSE-SV cycles The effect of theinsertion is to split each of these two cycles into paths andto splice these two paths together into asingle cycle via the newly createdSV edges We are increasing the number of edges and decreasing thenumber of cells so the surfacersquos genus increases Topologically this can be viewed as gluing a handlebetween the two cells and routing the new edge along this handle

ndash In acell-splitting insertion the two endpoints of the inserted edge belong to a single cell of the map andif the SE-SV cycle representing this cell is consistently oriented then SE(p) andSE(q) both point towardsor both point away from their endpointsp andq respectively The effect of the insertion is to split theSE-SV cycle into two paths and then reconnect the paths into two cycles forming two cells connectedacross the new edge We are increasing both the number of edges and the number of cells so the genusand the topology of the surface are preserved This was the only type of edge insertion allowed in [7]

ndash In acell-twisting insertion the two endpoints of the inserted edge belong to a single cell of the map butSE(p) andSE(q) are not consistently oriented The effect of the insertion is to split theSE-SV cycle intotwo paths and then reconnect the paths into a single cycle with the orientation of the two paths reversedfrom their previous situation We are increasing the numberof edges while preserving the number ofcells so the genus increases Topologically this can be viewed as gluing a crosscap into the cell androuting the new edge through it

Each of these types of insertion has a complementary deletion specified by the edge to be deleted whichwe call acell-splitting deletion acell-merging deletion or anuntwisting deletionrespectively In addition

6

we allow the dual operations to insertions and deletions asshown on the upper right of the figure dualdeletion is more familiar as the operation of edge contraction The dual of a cell-merging insertion mergestwo vertices of the graph while increasing the genus the dual of a cell-splitting insertion splits a vertexinto two adjacent vertices and the dual of a cell-twisting insertion changes the order of the edges and cellsaround a vertex We do not describe these in detail because our data structure will be self-dual so that eachdual operation is performed exactly as the primal operationsubstitutingSV for SC and vice versa

Finally it is possible to specify an insertion in whichSE(p) andSE(q) are not distinct Ifp 6= q whileSE(p) = SE(q) (Fig 2 lower left) we subdivideSE into a path of five edges and connect the four new gemvertices into anSV-SC cycle in such a way that adjacent vertices of the cycle are connected top andq Thiscan be viewed as a special case of a cell-splitting insertionin which the two endpoints of the inserted edgeare placed next to each other at the same vertex creating a one-sided cell contained within the previouslyexisting cell The dual of this operation adds a new degree-one vertex to the graph

If p = q we perform an edge insertion by again subdividingSE into a path of five edges and connectingthe four new gem vertices into anSV-SC cycle in such a way that opposite vertices of the cycle are connectedto p and the other endpoint ofSE(p) Edge insertion withp = q and dual edge insertion withp = q producethe same result shown in the lower right of Fig 2 This can beviewed as a special case of a cell-twistinginsertion in which the two endpoints of the inserted edge areplaced next to each other at the same vertex

42 Simple Dynamic Generators

We now describe a simple scheme for maintaining generators and minimum spanning trees in dynamic mapsbased on the dynamic planar graph algorithms of Eppstein et al [7] We will later show how to improve thetime bounds for this scheme at the expense of some additionalcomplexity

Theorem 1 Let M be a map with distinct edge weights changing according to the update operationsdescribed in the previous section as well as by changes to theweights of the edges Then in timeO(g logn)per update we can maintain a tree-cotree decomposition(T C X) where T is the minimum spanning treeC is the maximum spanning cotree and g is the genus of the map at the time of the update operation

Proof We representT by Sleator and Tarjanrsquos dynamic tree data structure [15] modified as in [7] to supportedge contraction and expansion operations as well as the more usual edge insertions and deletions We use asimilar data structure to represent the dual treeClowast With this data structure we can find in logarithmic timethe longest edge on any path ofT or the shortest edge on any path ofClowast We can also test in logarithmic timewhether a pair of edgese eprime forms aswap that is whetherTe eprime (where denotes the set-theoreticsymmetric difference) is another spanning tree ofT We also maintain the tree data structures discussed inSection 2 for the adjacency lists of each vertex and face ofM which allow us to classify the type of aninsertion or deletion in logarithmic time

To increase the weight of an edgee in T cup X we first test whether the increased weight causes the edgeto move to the maximum cotreeC by finding the shortest edgeeprime on the dual path connecting the endpointsof elowast and testing whether the dual swape eprime increases the weight ofC If so we adde to C and moveeprime

to X We then searchX for the minimum weight edgeeprimeprime forming a swape eprimeprime in T and testing whetherthis swap causes an improvement in the weight ofT If it does we addeprimeprime to T and movee to X Lemma 1shows that after these steps we must again have a tree-cotree partition To decrease the weight of an edgeein Ccup X we perform a similar sequence of steps on the dual tree-cotree-partition(Clowast Tlowast Xlowast)

We now describe the effect on our data structure of the various insertion and deletion operations Theedge expansions and contractions are performed by very similar sequences of steps in the dual map

ndash To perform a cell-merging insertion of an edgee we find the lightest edgeeprime on the dual path inClowast

connecting the merged cells and place botheandeprime in X We then perform swaps similar to those for a

7

weight change to determine whethere should move intoT or C To perform a cell-splitting deletion ofe we searchX for the heaviest edgeeprime connecting the two components ofClowast formed by the split andmoveeprime into C

ndash To perform a cell-splitting insertion of an edgee we adde to X searchX for the heaviest edgeeprime

connecting the two components ofClowast formed by the split and perform swaps similar to those for aweight change to determine whether to movee into T or C To perform a cell-merging deletion ofewe increase the weight ofe until it belongs toC then remove it from the graph and merge its two dualendpoints

ndash To perform a cell-twisting insertion of an edgee we simply adde to X search for the best swape eprimewith eprime isin T and perform this swap if it improves the weight ofT The inserted edgeecan not belong toC sinceelowast connects a dual vertex to itself To perform an untwisting deletion we test whetherebelongsto T and if so swap it with the best replacementeprime isin X before removing it

Each of these operations maintains the desired partition via a sequence ofO(g) dynamic tree queriesand updates so the total time per change toM isO(g logn) ⊓⊔

If we wish to maintain a tree-cotree decomposition of a graphwithout weights we can choose weightsfor the edges arbitrarily

43 Improved Dynamic Generators

The bottleneck of Theorem 1 is the search for swaps in graphsT cup X or Clowast cup Xlowast performing this search bytesting each edge inXlowast takes timeO(g logn) We can improve this by using the method of separator basedsparsification [6] to replaceT andClowast by contracted treesTprime andCprime that match theO(g) size ofX and thenapplying a general dynamic graph connectivity algorithm [12 18] to find the swaps in the smaller graphsTprime cup X or Cprime cup Xlowast

Specifically we formTprime from T by repeated edge contractions forming a sequence of treesT0 =T T1 Tk = Tprime If Ti contains a vertex with degree one that is not an endpoint of anedge inX wedelete that vertex and its adjacent edge to formTi+1 Otherwise ifTi contains a vertex with degree two thatis not an endpoint of an edge inX let e andeprime be the two edges incident to that vertex we formTi+1 bycontracting whichever ofe andeprime has the smaller weight The construction ofCprime from Clowast is essentially thesame except that we contract the larger weight of two edges incident to any degree two vertex

Lemma 3 The trees Tprime and Cprime described above haveO(|X|) edges and do not depend on the order inwhich the contractions are performed

Proof Consider the set of paths inT connecting endpoints ofX The union of these paths forms a subtreeTprimeprime

of T Then an alternative description ofTprime is that it consists of one edge for each path of degree-two verticesin Tprimeprime with the weight of this edge equal to the maximum weight of anedge in the path Specifically eachdeletion of a degree one vertex removes an edge that is not inTprimeprime and each contraction of a degree twovertex reduces the length of one of the paths inTprimeprime without changing the maximum weight of an edge on thepath This proves the assertion thatTprime is independent of the contraction order it hasO(|X|) edges becauseit has at most|X| leaves and no internal degree-two vertices ⊓⊔

Lemma 4 Trees Tprime and Cprime can be updated after any change to T or Clowast in timeO(logn) per change Eachchange to T C or X causesO(1) edges to change in Tprime and Cprime

Proof We use the following data structures forT First we use a dynamic tree data structure [15] that canfind the maximum weight edge on any path ofT and that can determine for any three query vertices ofT

8

which vertex forms the branching point between the paths connecting the three vertex Second we maintainan Euler tour data structure [11] that can find for a query vertex in T the one or two nearest vertices thatbelong toTprime Whenever a change toX adds a vertexv to the set of endpoints inX we must also addvto Tprime we do this by querying the Euler tour data structure to find the edge or vertex ofTprime at which thebranch tov should be added querying the dynamic tree data structure tofind the correct branching point onthat edge giving the overall graph structure of the new treeTprime and finally querying the dynamic tree datastructure again to find the weights of the changed edges inTprime To remove a vertex from the endpoints inXwe simply contract one or two edges as necessary inTprime To perform a swap inT we use the data structuresas described above to make all swap endpoints part ofTprime perform the swap and then contract edges toremove unnecessary vertices from the changedTprime The updates toCprime are similar ⊓⊔

Lemma 5 Let e be an edge of T that was not contracted in forming Tprime and let eprime be an edge of X Thene eprime is a swap in T if and only if it is a swap in Tprime

Lemma 6 Let eprime be an edge in X and let e be the heaviest edge forming a swape eprime in T Then e is notcontracted in forming Tprime

Theorem 2 Let M be a map with distinct edge weights changing according to the update operationsdescribed in the previous section as well as by changes to theweights of the edges Then in amortizedtimeO(logn + (logg)4) per update we can maintain a tree-cotree decomposition(T C X) where T is theminimum spanning tree C is the maximum spanning cotree andg is the genus of the map at the time of theupdate operation

Proof The overall algorithm is the same as the one in Theorem 1 but we use the data structures describedabove to maintain treesTprime andCprime and use the dynamic minimum spanning tree data structure ofHolm etal [12] to find the edgeeprime isin X forming the best swap for any edgeeisin T or elowast isin Clowast The time bound followsfrom plugging theO(|X|) bound on the number of edges inTprime cup X andCprime cup Xlowast into the time bound forthe minimum spanning tree data structure and using this bound to replace theO(g logn) time for findingreplacement edges in Theorem 1 ⊓⊔

The final improvement to our bounds comes from the observation that if we only wish to maintain atree-cotree decomposition for a graph without weights then we can replace the dynamic minimum spanningtree data structures forTprime cup X andCprime cup X with any dynamic connectivity data structure that maintains aspanning tree of these two dynamic graphs and changes the tree by a single swap per update to the graphsThe connectivity structure of Holm et al [12] as improved byThorup [18] is a suitable replacement

Theorem 3 Let M be a map with distinct edge weights changing according to the update operationsdescribed in the previous section as well as by changes to theweights of the edges Then in amortized timeO(logn + logg(log logg)3) per update we can maintain a tree-cotree decomposition(T C X) where g isthe genus of the map at the time of the update operation

44 Orientability

The results above are nearly sufficient to determine the surface underlying the dynamic mapM since itis known that 2-dimensional closed surfaces are classified by two quantities their genus (which we cancalculate from|X|) and theorientability of the surface We can compute the orientability from the followingsimple result which follows from the fact that the loops generated by edges inX form a cutset

9

Lemma 7 LetM have a tree-cotree decomposition(T C X) Then The surface on whichM is embeddedis unorientable if and only if every sufficiently small neighborhood of at least one of the loopsloop(T e) |eisin X is homeomorphic to a Mobius strip

Theorem 4 Let M be a map with distinct edge weights changing according to the update operationsdescribed in the previous section as well as by changes to theweights of the edges Then in amortized timeO(logn+ logg(log logg)3) per update we can determine after each update whether the surface underlyingthe map is orientable

Proof For any path inM we can form a sufficiently small neighborhood of the path by gluing togethera collection of disks where each disk has as its boundary thegem cycle representing a vertex or edge inthe path We choose an arbitrary clockwise orientation for the gem cycle representing each vertex inMand augment the Sleator-Tarjan dynamic tree data structureused to maintain the treeT in the tree-cotreedecomposition(T C X) by storing an extra bit per tree edge that is zero when the edgersquos preserves thechosen orientations of its two endpoints and one when it reverses these orientations we can use the dynamictree data structure to determine the parity of the sum of these bits along any path inT After each changeto the tree-cotree decomposition we use this data structure to determine whether anye isin X forms a loopwith odd total parity (including the parity ofe itself) If any odd loop is found the map is unorientable ifall loops are even the map is orientable ⊓⊔

5 Separator Theorems

Since Lipton and Tarjanrsquos discovery of the planar separatortheorem [14] separator theorems have becomewidely used in algorithms and there has been much work on improved constants for these theorems For-mally we define anǫ-separator of ann-vertex graphG to be a subsetSof the vertices ofG such that eachconnected component ofGShas at mostǫn vertices For graphs embedded on a genus-g orientable surfaceAleksandrov and Djidjev [1] showed that there always existsanǫ-separator with|S| le

radic

(16g + O(1ǫ))nWe combine our tree-cotree decomposition idea with the Lipton-Tarjan method of partitioning the breadthfirst search tree into levels (also used by Aleksandrov and Djidjev) to improve this result and extend it tounorientable surfaces

By Eulerrsquos formula if(T C X) is a tree-cotree decomposition of a map on an orientable surface then|X| = 2g whereg is the genus of the surface on whichM is embedded If the surface is unorientablethen |X| = g Because of this confusion between orientable and unorientable surfaces we prefer to usetheEuler characteristicχ(M) = |X| minus 2 in stating our results In terms ofχ Aleksandrov and Djidjevrsquosresult is that there exists a separator with|S| le

radic

(8χ + O(1ǫ))n We improve this by a factor ofradic

2 to|S| le

radic

(4χ + O(1ǫ))nLet T be a breadth first search tree of the given graph and form a tree-cotree decomposition(T C X)

For any pair of integers 0le i lt k define vertex setsLik andSik as followsLik consists of all verticesvwhose depthd(v) in T satisfiesd(v) equiv i (mod k) Sik is formed by adding toLik a pathPik(v) for eachendpointv of an edge inX wherePik(v) sub T connectsv to the first member ofLik on the path fromv tothe root ofT

Lemma 8 For any i and k G Sik is planar

Proof Extend the depth function on vertices to a continuous function λ M 7rarr R that maps each vertexto its depth maps each edge ofG one-to-one onto the interval between the depths of its endpoints andmaps each cell ofM in such a way that the map has no local minima or maxima in the interior of thecell Partition the surface underlying the mapM into submanifolds with boundary by removing all points

10

x for which λ(x) = i mod k Then each submanifold is formed fromM by cutting certain curves at depthλ(x) = i + ak (for some integera) and certain other curves at depthλ(x) = i + (a+ 1)k If we cap off thesecut curves with disks we form a manifoldMa without boundary Within each of the added disks at depthλ(x) = i + ak add a vertex connected by edges to all the vertices on the boundary of the disk the result isa graphGa embedded inMa such that each edge and vertex inGSik belongs to exactly one of the graphsGa If we let Ta be formed from the union ofT cap Ga with the newly added edges inGa thenTa is a forestdisjoint from the coforestC cap Ga so we can extend these two subgraphs to a tree-cotree decomposition(Tprime

a Cprimea Xprime

a) such thatXprimea sub XcapGa Therefore the pathsPik(v) for v an endpoint of an edge inXcapGa form

a cutset forMa andSik is a cutset for all ofM ⊓⊔

Lemma 9 For any k and any map embedded on a surface with Euler characteristic χsum

0leiltk

|Sik| le n + (χ + 2)k(kminus 1)

Proof Each vertex of the map belongs to exactly one graphLik In addition each of the 2(χ+ 2) endpointsv of edges inX contributes

sum |Pik(v)| =sum

0leiltk i vertices to the total Some vertices may be in more thanone pathPik(v) but this only reduces the total ⊓⊔

Theorem 5 Any n-vertex graph G embedded on a surface with Euler characteristic χ has anǫ-separatorwith |S| le

radic

(4χ + O(1ǫ))n vertices

Proof By choosingi minimizing |Sik| we achieve|Sik| le nk+χk+O(k) The result follows by choosingk =

radic

nχ applying a planar separator theorem to the planar graphG Sik and forming the union of theplanar separator withSik ⊓⊔

If a map representing a characteristic-χ embedding ofG is given as input the method described in theproof of the theorem can be implemented to run in time linear in the size of the map and produces a cutsetof size at most

radic

(4χ + O(1))n The time bound for the overall algorithm and the constant factor in theradic

O(nǫ) term in the separator size depend on the choice of planar separator algorithm used to completethe separator construction

We note that not all loops need always be incorporated inSik in order to makeG Sik planar Forinstance ifG is embedded on a torus it can be cut into a planar graph in the form of a cylinder by removingonly one of the two loops In addition if we chooseSik in such a way that some of the subgraphsTa andC cap Ga described in the proof of Lemma 8 are disconnected then additional edges are removed fromX informing the tree-cotree decompositions ofMa and again we can reduce the number of loops Can we usethese observations to further reduce the constant factor inour separator theorem

6 Low-Diameter Tree Decomposition

In previous work [5] we showed that in a minor-closed graph family the treewidth of a graph with diameterD can be bounded by a function ofD if and only if the family excludes some apex graph For instance forplanar graphs (which exclude the apex graphK5) the treewidth is at most 3D minus O(1) [2] Suchboundedlocal treewidthresults can be used to find efficient solutions to many important algorithmic problems onthese graphs [2459]

In particular any graph embedded on a genusg = O(1) surface has bounded local treewidth since thefamily of such graphs is minor-closed and excludes an apex graph However the treewidth bound from thisgeneral result grows rapidly withg and in this special case we were able to prove a tighter bound

11

Theorem 6 (Eppstein [5])Let G have genus g and diameter D Then G has treewidthO(gD)

The proof relies on showing the existence of a cutset of sizeO(gD) and forming a tree-decompositionby adding this cutset to each node in a tree-decomposition ofthe remaining planar graph However one stepin the proof is to find the minimum cardinality cutset so the proof is nonconstructive and Erickson andSar-Peled [8] later showed that in fact finding minimum cutsets is NP-complete By replacing this step withmethods based on our tree-cotree decomposition we can turnthis nonconstructive proof into an efficientalgorithm

Theorem 7 Let G have genus g and diameter D and suppose that we are givenas input an embeddingMof G on a surface of genus g Then in timeO(gDn) we can find a tree-decomposition of G with treewidthO(gD)

Proof We form a tree-decomposition(T C X) by lettingT be a breadth-first spanning tree ofG and lettingC be any spanning cotree disjoint fromT We then letSbe the set of vertices incident to the edges in loopsloop(T e) | eisin X Each loop has at most 2D edges so|S| = O(gD) andG S is planar so it has a tree-decomposition of treewidth 3DminusO(1) that can be found in timeO(Dn) [2] We form a tree-decompositionof G by addingS to each node in the tree-decomposition ofG S ⊓⊔

TheO(gDn) time bound is optimal in the sense that it is the size of an explicit representation of theresulting tree-decomposition but if we represent the setsof vertices at each tree-decomposition node im-plicitly as a union of a constant number of paths in the two treesT andB the time can be reduced to linearin the size of the input mapM

7 Conclusions

We have shown how the tree-cotree decomposition can be used in several applications for graphs embeddedon surfaces maintaining dynamic properties of the graph computing separators and constructing tree-decompositions of small treewidth There are many other important planar graph algorithms that can begeneralized to graphs embedded on surfaces and it would be interesting to see which others of these can beimproved by the use of our tree-cotree decomposition methods

Acknowledgements

This research was supported in part by NSF grant CCR-9912338

References

1 L Aleksandrov and H Djidjev Linear algorithms for partitioning embedded graphs of bounded genusSIAM J DiscreteMath9129ndash150 1996 httpwwwdcswarwickacuksimhristopapersgenus-separatorpsZ

2 B S Baker Approximation algorithms for NP-complete problems on planar graphsJ Assoc Comput Mach41153ndash1801994

3 C P Bonnington and C H C LittleThe Foundations of Topological Graph Theory Springer-Verlag 19954 D Eppstein Subgraph isomorphism in planar graphs and related problemsJ Graph Algorithms amp Applications3(3)1ndash27

1999 arXivcsDS99110035 D Eppstein Diameter and treewidth in minor-closed graph familiesAlgorithmica27275ndash291 2000

httplinkspringer-nycomlinkservicejournals00453contents0010020 arXivmathCO99071266 D Eppstein Z Galil G F Italiano and T H Spencer Separator based sparsification I planarity testing and minimum

spanning treesJ Computing amp Systems Sciences52(1)3ndash27 February 19967 D Eppstein G F Italiano R Tamassia R E Tarjan J R Westbrook and M Yung Maintenance of a minimum spanning

forest in a dynamic planar graphJ Algorithms13(1)33ndash54 March 1992

12

8 J Erickson and S Har-Peled Optimally cutting a surfaceinto a diskProc 18th ACM Symp Computational Geometrypp 244ndash253 June 2002 httpcompgeomcsuiucedusimjeffepubsschemahtml arXivcsCG0207004

9 M Grohe Local tree-width excluded minors and approximation algorithms arXivorg e-Print archive January 2000arXivmathCO0001128

10 J L Gross and T W TuckerTopological Graph Theory Dover Publications 200111 M R Henzinger and V King Randomized fully dynamic graph algorithms with polylogarithmic time per operationJ ACM

46(4)502ndash536 July 199912 J Holm K de Lichtenberg and M Thorup Poly-logarithmic deterministic fully-dynamic graph algorithms for connectivity

minimum spanning tree 2-edge and biconnectivityJ ACM48(4)723ndash760 July 200113 S Lins Graph-encoded mapsJ Combinatorial Theory Ser B32171ndash181 198214 R Lipton and R E Tarjan A separator theorem for planargraphsSIAM J Applied Math36(2)177ndash189 April 197915 D D Sleator and R E Tarjan A data structure for dynamic treesJ Computing amp Systems Sciences26362ndash391 198316 D A Spielman and S-H Teng Disk packings and planar separatorsProc 12th ACM Symp Computational Geometry

pp 349ndash358 1996 httpwww-mathmitedusimspielmanResearchseparatorhtml17 J StillwellClassical Topology and Combinatorial Group Theory Graduate Texts in Mathematics 72 Springer-Verlag 2nd

edition 199318 M Thorup Near-optimal fully-dynamic graph connectivity Proc 32nd ACM Symp Theory of Computing pp 343ndash350 May

200019 G Vegter and C-K Yap Computational complexity of combinatorial surfacesProc 6th ACM Symp Computational

Geometry pp 102ndash111 1990 httpwwwacmorgpubscitationsproceedingscompgeom98524p102-vegter

13

Page 4: Dynamic Generators of Topologically Embedded Graphs

graph-theoretic and independent of any drawing of the gem The edges of this graph should be viewed ashaving three colors representing the type of operation generating the edge in the figure these are shown asdashed dotted and solid respectively

For each vertex of the map withd adjacent edges the resulting gem has a 2d-cycle with edges alternatingbetween typesSE and SF For each edge of the map the gem has a quadrilateral with edges alternatingbetween typesSV andSC And for eachk-gon cell of the map the gem has a 2k-cycle with edges alternatingbetween typesSV andSE In this way every map generates a 3-regular 3-edge-colored graph in which theSV-SC cycles all have four edges Conversely given any such graph we can recover the original map byforming ak-gon cell for each 2k-cycle of edges of typesSV andSE and by gluing these cells together into amanifold whenever the corresponding edges of typesSV are part of a four-cycle of typesSV andSC

Any mapM has adual mapMlowast on the same surface formed by creating a dual vertexf lowast within eachfacef of the primal map and creating a dual edgeelowast for every primal edgee so that ife is adjacent to twofacesf1 andf2 thenelowast connectsf lowast1 andf lowast2 by a path that crossese once and crosses no other primal or dualedge In the gem representation the dual can be formed very simply by reversing the roles of the gem edgesof typesSV andSC

In our dynamic graph data structures we will augment the gemrepresentation by balanced binary treesfor the cycles corresponding to each vertex and cell of the map in this way we can quickly look up whichvertexrsquos or cellrsquos cycle contains a given edge of the gem andwhether two edges on the same cycle are in thesame or opposite orientations around the cycle

3 Trees and Generators

A spanning treeof a graph or map is just a tree formed by some subset of the edges of the graph thatincorporates all the vertices of the graph IfClowast is a spanning tree of the dual of a map we callC = e | elowast isinClowast a spanning cotreeof the map If the edges of a map are given weights the weight of a tree or cotree isdefined to be the sum of the weights of its edges

Lemma 1 Let a mapM be given with distinct weights on each of its edges Then theminimum weightspanning tree ofM and the maximum weight spanning cotree ofM are disjoint

Proof Let ebe an edge in the minimum spanning tree ofM Then removinge from the minimum spanningtree results in a forestF with two connected components letF1 be one of those components Then thesequence of faces ofM surroundingF1 forms a (possibly non-simple) cycle inMlowast consisting of the dualsof all edges connectingF1 to F2 Sincee belongs to the minimum spanning treeelowast must be the shortestedge in this dual cycle and so cannot belong to the maximum spanning tree ofMlowast ⊓⊔

In the special case of planar graphs the minimum spanning tree and maximum spanning cotree forma partition of all the edges of the graph [7] We define atree-cotree partitionof M to be a triple(T C X)whereT is a spanning tree ofM C is a spanning cotree ofM and the three setsT C andX are disjointand together include all edges ofM In particular ifT is the minimum spanning tree andC is the maxi-mum spanning cotree then(T C E(M) (T cup C)) is a tree-cotree decomposition By assigning weightsappropriately we can use Lemma 1 to find a tree-cotree decomposition involving any given treeT or cotreeC More generally ifT andClowast are forests such thatT andC are disjoint we can assign weights to makeTbecome part of the minimum spanning tree andC become part of the maximum spanning cotree extendingT andC to a tree-cotree decomposition

We now show how these decompositions are connected to fundamental groups of surfaces Thefunda-mental groupof a spaceS is most commonly defined relative to some base pointx0 isin S but for suitablespaces (including the 2-manifolds considered here) it is independent of the choice of this base point Definea loop to be a continuous functionf [0 1] 7rarr Ssatisfyingf (0) = f (1) = x0 and define two loopsf0 andf1

4

to behomotopy equivalentif there exists a continuous functionf [0 1]2 7rarr Ssuch thatf (x i) = fi(x) andf (0 i) = f (1 i) = x0 Define theproductof two loopsf0 andf1 to be the loop

f (x) =

f0(2x) for 0 le x le 12f1(2xminus 1) for 12 le x le 1

Then it can be shown that homotopy equivalence is an equivalence relation and that the homotopy equiv-alence classes of loops form a group thefundamental group under homotopy equivalence In this groupinverses can be found by reversing the direction of a loop iff is a loopg(x) = f (1minus x) is a loop inverse tof A set of loops is said togeneratethe fundamental group if every other equivalence class of loops can bereached by products of these generators and their inverses

If we are given a rooted treeT and oriented edgee isin T with the base pointx0 of the fundamental loopat the root ofT we can define a loop loop(T e) by following a path inT from x0 to the head ofe thentraversing edgee to its tail and finally following a path inT from that tail back tox0 When consideringthese loops as generators of the fundamental group the orientation ofe is unimportant since reversing theedge merely produces the inverse group element

Lemma 2 Let (T C X) be a tree-cotree decomposition of mapM Then the loopsloop(T e) | e isin Xgenerate the fundamental group of the surface on whichM is embedded

Proof Contract the edges inT into the rootx0 of T while leaving the surface unchanged outside of a smallneighborhood ofT this contraction does not change the fundamental group of the surface In the contractedimage the loops from the statement of the lemma are each contracted into a single edge connectingx0 toitself Decompose the surface into a setS1 consisting of a small neighborhood of the set of these contractedloops and a setS2 consisting of the faces of the map and the cotree edges inC Then by the Seifert ndash VanKampen theorem [17 Section 34] the fundamental group of the overall surface can be formed by combiningthe generators and relations of the fundamental groups of these two pieces with additional relations describ-ing the way these two pieces fit togetherS1 can be contracted to a graph with one vertex and|X| self-loopswhich has a fundamental group with each of these loops as generators and no relationsS2 is topologicallya disk (since it consists of a collection of disk faces glued together in the pattern of a tree) so it has a trivialfundamental group The fundamental group of the overall surface then is generated by the loops describedin the statement of the lemma with a single relation formed by the concatenation of these loops around theboundary ofS2 ⊓⊔

Of course for any treeT the loopsloop(T e) | e isin T also generate the fundamental group butin general this will form a much larger system of generatorsThe advantage of the system of generatorsprovided by Lemma 2 is its small cardinality proportional to the genus of the surface

The same tree-contraction argument used in Lemma 2 also shows that the edges in the loopsloop(T e) |eisin X form a cutset

4 Dynamic Generators

41 Update Operations

Following [7] we allow four types of update operation insertion of a new edge between two verticesdeletion of an edge dual edge insertion (expansion) and dual edge deletion (contraction) The effect ofthese updates on the gem representation is shown in Figure 2

The location of an edge insertion can be specified by a pair of gem verticesp andq shown as shadedtriangles in the figure We then subdivide the two gem edgesSE(p) andSE(q) into paths ofSE andSC edgespreserving the connectivity of theSE-SC cycles representing vertices in the gem and create a new graph

5

Fig 2 Effects of edge insertion and deletion and their duals on thegem representation

edge (represented in the gem by a 4-cycle ofSV andSC edges) using theSC edges of the subdivided pathsin such a way that the new gem edgesSE(p) andSE(q) are adjacent to a common edge of typeSV

In the most typical case of an edge insertion (Fig 2 upper right) the two edgesSE(p) andSE(q) aredistinct each of these edges is subdivided into a three-edge path and the two new vertices on each path areconnected in pairs by newSV edges We distinguish three subcases of this operation depending on whichcells of the map contain the endpoints of the inserted edge

ndash In a cell-merging insertion the two endpoints of the inserted edge are attached into distinct cells ofthe map that is the two gem edgesSE(p) andSE(q) belong to distinctSE-SV cycles The effect of theinsertion is to split each of these two cycles into paths andto splice these two paths together into asingle cycle via the newly createdSV edges We are increasing the number of edges and decreasing thenumber of cells so the surfacersquos genus increases Topologically this can be viewed as gluing a handlebetween the two cells and routing the new edge along this handle

ndash In acell-splitting insertion the two endpoints of the inserted edge belong to a single cell of the map andif the SE-SV cycle representing this cell is consistently oriented then SE(p) andSE(q) both point towardsor both point away from their endpointsp andq respectively The effect of the insertion is to split theSE-SV cycle into two paths and then reconnect the paths into two cycles forming two cells connectedacross the new edge We are increasing both the number of edges and the number of cells so the genusand the topology of the surface are preserved This was the only type of edge insertion allowed in [7]

ndash In acell-twisting insertion the two endpoints of the inserted edge belong to a single cell of the map butSE(p) andSE(q) are not consistently oriented The effect of the insertion is to split theSE-SV cycle intotwo paths and then reconnect the paths into a single cycle with the orientation of the two paths reversedfrom their previous situation We are increasing the numberof edges while preserving the number ofcells so the genus increases Topologically this can be viewed as gluing a crosscap into the cell androuting the new edge through it

Each of these types of insertion has a complementary deletion specified by the edge to be deleted whichwe call acell-splitting deletion acell-merging deletion or anuntwisting deletionrespectively In addition

6

we allow the dual operations to insertions and deletions asshown on the upper right of the figure dualdeletion is more familiar as the operation of edge contraction The dual of a cell-merging insertion mergestwo vertices of the graph while increasing the genus the dual of a cell-splitting insertion splits a vertexinto two adjacent vertices and the dual of a cell-twisting insertion changes the order of the edges and cellsaround a vertex We do not describe these in detail because our data structure will be self-dual so that eachdual operation is performed exactly as the primal operationsubstitutingSV for SC and vice versa

Finally it is possible to specify an insertion in whichSE(p) andSE(q) are not distinct Ifp 6= q whileSE(p) = SE(q) (Fig 2 lower left) we subdivideSE into a path of five edges and connect the four new gemvertices into anSV-SC cycle in such a way that adjacent vertices of the cycle are connected top andq Thiscan be viewed as a special case of a cell-splitting insertionin which the two endpoints of the inserted edgeare placed next to each other at the same vertex creating a one-sided cell contained within the previouslyexisting cell The dual of this operation adds a new degree-one vertex to the graph

If p = q we perform an edge insertion by again subdividingSE into a path of five edges and connectingthe four new gem vertices into anSV-SC cycle in such a way that opposite vertices of the cycle are connectedto p and the other endpoint ofSE(p) Edge insertion withp = q and dual edge insertion withp = q producethe same result shown in the lower right of Fig 2 This can beviewed as a special case of a cell-twistinginsertion in which the two endpoints of the inserted edge areplaced next to each other at the same vertex

42 Simple Dynamic Generators

We now describe a simple scheme for maintaining generators and minimum spanning trees in dynamic mapsbased on the dynamic planar graph algorithms of Eppstein et al [7] We will later show how to improve thetime bounds for this scheme at the expense of some additionalcomplexity

Theorem 1 Let M be a map with distinct edge weights changing according to the update operationsdescribed in the previous section as well as by changes to theweights of the edges Then in timeO(g logn)per update we can maintain a tree-cotree decomposition(T C X) where T is the minimum spanning treeC is the maximum spanning cotree and g is the genus of the map at the time of the update operation

Proof We representT by Sleator and Tarjanrsquos dynamic tree data structure [15] modified as in [7] to supportedge contraction and expansion operations as well as the more usual edge insertions and deletions We use asimilar data structure to represent the dual treeClowast With this data structure we can find in logarithmic timethe longest edge on any path ofT or the shortest edge on any path ofClowast We can also test in logarithmic timewhether a pair of edgese eprime forms aswap that is whetherTe eprime (where denotes the set-theoreticsymmetric difference) is another spanning tree ofT We also maintain the tree data structures discussed inSection 2 for the adjacency lists of each vertex and face ofM which allow us to classify the type of aninsertion or deletion in logarithmic time

To increase the weight of an edgee in T cup X we first test whether the increased weight causes the edgeto move to the maximum cotreeC by finding the shortest edgeeprime on the dual path connecting the endpointsof elowast and testing whether the dual swape eprime increases the weight ofC If so we adde to C and moveeprime

to X We then searchX for the minimum weight edgeeprimeprime forming a swape eprimeprime in T and testing whetherthis swap causes an improvement in the weight ofT If it does we addeprimeprime to T and movee to X Lemma 1shows that after these steps we must again have a tree-cotree partition To decrease the weight of an edgeein Ccup X we perform a similar sequence of steps on the dual tree-cotree-partition(Clowast Tlowast Xlowast)

We now describe the effect on our data structure of the various insertion and deletion operations Theedge expansions and contractions are performed by very similar sequences of steps in the dual map

ndash To perform a cell-merging insertion of an edgee we find the lightest edgeeprime on the dual path inClowast

connecting the merged cells and place botheandeprime in X We then perform swaps similar to those for a

7

weight change to determine whethere should move intoT or C To perform a cell-splitting deletion ofe we searchX for the heaviest edgeeprime connecting the two components ofClowast formed by the split andmoveeprime into C

ndash To perform a cell-splitting insertion of an edgee we adde to X searchX for the heaviest edgeeprime

connecting the two components ofClowast formed by the split and perform swaps similar to those for aweight change to determine whether to movee into T or C To perform a cell-merging deletion ofewe increase the weight ofe until it belongs toC then remove it from the graph and merge its two dualendpoints

ndash To perform a cell-twisting insertion of an edgee we simply adde to X search for the best swape eprimewith eprime isin T and perform this swap if it improves the weight ofT The inserted edgeecan not belong toC sinceelowast connects a dual vertex to itself To perform an untwisting deletion we test whetherebelongsto T and if so swap it with the best replacementeprime isin X before removing it

Each of these operations maintains the desired partition via a sequence ofO(g) dynamic tree queriesand updates so the total time per change toM isO(g logn) ⊓⊔

If we wish to maintain a tree-cotree decomposition of a graphwithout weights we can choose weightsfor the edges arbitrarily

43 Improved Dynamic Generators

The bottleneck of Theorem 1 is the search for swaps in graphsT cup X or Clowast cup Xlowast performing this search bytesting each edge inXlowast takes timeO(g logn) We can improve this by using the method of separator basedsparsification [6] to replaceT andClowast by contracted treesTprime andCprime that match theO(g) size ofX and thenapplying a general dynamic graph connectivity algorithm [12 18] to find the swaps in the smaller graphsTprime cup X or Cprime cup Xlowast

Specifically we formTprime from T by repeated edge contractions forming a sequence of treesT0 =T T1 Tk = Tprime If Ti contains a vertex with degree one that is not an endpoint of anedge inX wedelete that vertex and its adjacent edge to formTi+1 Otherwise ifTi contains a vertex with degree two thatis not an endpoint of an edge inX let e andeprime be the two edges incident to that vertex we formTi+1 bycontracting whichever ofe andeprime has the smaller weight The construction ofCprime from Clowast is essentially thesame except that we contract the larger weight of two edges incident to any degree two vertex

Lemma 3 The trees Tprime and Cprime described above haveO(|X|) edges and do not depend on the order inwhich the contractions are performed

Proof Consider the set of paths inT connecting endpoints ofX The union of these paths forms a subtreeTprimeprime

of T Then an alternative description ofTprime is that it consists of one edge for each path of degree-two verticesin Tprimeprime with the weight of this edge equal to the maximum weight of anedge in the path Specifically eachdeletion of a degree one vertex removes an edge that is not inTprimeprime and each contraction of a degree twovertex reduces the length of one of the paths inTprimeprime without changing the maximum weight of an edge on thepath This proves the assertion thatTprime is independent of the contraction order it hasO(|X|) edges becauseit has at most|X| leaves and no internal degree-two vertices ⊓⊔

Lemma 4 Trees Tprime and Cprime can be updated after any change to T or Clowast in timeO(logn) per change Eachchange to T C or X causesO(1) edges to change in Tprime and Cprime

Proof We use the following data structures forT First we use a dynamic tree data structure [15] that canfind the maximum weight edge on any path ofT and that can determine for any three query vertices ofT

8

which vertex forms the branching point between the paths connecting the three vertex Second we maintainan Euler tour data structure [11] that can find for a query vertex in T the one or two nearest vertices thatbelong toTprime Whenever a change toX adds a vertexv to the set of endpoints inX we must also addvto Tprime we do this by querying the Euler tour data structure to find the edge or vertex ofTprime at which thebranch tov should be added querying the dynamic tree data structure tofind the correct branching point onthat edge giving the overall graph structure of the new treeTprime and finally querying the dynamic tree datastructure again to find the weights of the changed edges inTprime To remove a vertex from the endpoints inXwe simply contract one or two edges as necessary inTprime To perform a swap inT we use the data structuresas described above to make all swap endpoints part ofTprime perform the swap and then contract edges toremove unnecessary vertices from the changedTprime The updates toCprime are similar ⊓⊔

Lemma 5 Let e be an edge of T that was not contracted in forming Tprime and let eprime be an edge of X Thene eprime is a swap in T if and only if it is a swap in Tprime

Lemma 6 Let eprime be an edge in X and let e be the heaviest edge forming a swape eprime in T Then e is notcontracted in forming Tprime

Theorem 2 Let M be a map with distinct edge weights changing according to the update operationsdescribed in the previous section as well as by changes to theweights of the edges Then in amortizedtimeO(logn + (logg)4) per update we can maintain a tree-cotree decomposition(T C X) where T is theminimum spanning tree C is the maximum spanning cotree andg is the genus of the map at the time of theupdate operation

Proof The overall algorithm is the same as the one in Theorem 1 but we use the data structures describedabove to maintain treesTprime andCprime and use the dynamic minimum spanning tree data structure ofHolm etal [12] to find the edgeeprime isin X forming the best swap for any edgeeisin T or elowast isin Clowast The time bound followsfrom plugging theO(|X|) bound on the number of edges inTprime cup X andCprime cup Xlowast into the time bound forthe minimum spanning tree data structure and using this bound to replace theO(g logn) time for findingreplacement edges in Theorem 1 ⊓⊔

The final improvement to our bounds comes from the observation that if we only wish to maintain atree-cotree decomposition for a graph without weights then we can replace the dynamic minimum spanningtree data structures forTprime cup X andCprime cup X with any dynamic connectivity data structure that maintains aspanning tree of these two dynamic graphs and changes the tree by a single swap per update to the graphsThe connectivity structure of Holm et al [12] as improved byThorup [18] is a suitable replacement

Theorem 3 Let M be a map with distinct edge weights changing according to the update operationsdescribed in the previous section as well as by changes to theweights of the edges Then in amortized timeO(logn + logg(log logg)3) per update we can maintain a tree-cotree decomposition(T C X) where g isthe genus of the map at the time of the update operation

44 Orientability

The results above are nearly sufficient to determine the surface underlying the dynamic mapM since itis known that 2-dimensional closed surfaces are classified by two quantities their genus (which we cancalculate from|X|) and theorientability of the surface We can compute the orientability from the followingsimple result which follows from the fact that the loops generated by edges inX form a cutset

9

Lemma 7 LetM have a tree-cotree decomposition(T C X) Then The surface on whichM is embeddedis unorientable if and only if every sufficiently small neighborhood of at least one of the loopsloop(T e) |eisin X is homeomorphic to a Mobius strip

Theorem 4 Let M be a map with distinct edge weights changing according to the update operationsdescribed in the previous section as well as by changes to theweights of the edges Then in amortized timeO(logn+ logg(log logg)3) per update we can determine after each update whether the surface underlyingthe map is orientable

Proof For any path inM we can form a sufficiently small neighborhood of the path by gluing togethera collection of disks where each disk has as its boundary thegem cycle representing a vertex or edge inthe path We choose an arbitrary clockwise orientation for the gem cycle representing each vertex inMand augment the Sleator-Tarjan dynamic tree data structureused to maintain the treeT in the tree-cotreedecomposition(T C X) by storing an extra bit per tree edge that is zero when the edgersquos preserves thechosen orientations of its two endpoints and one when it reverses these orientations we can use the dynamictree data structure to determine the parity of the sum of these bits along any path inT After each changeto the tree-cotree decomposition we use this data structure to determine whether anye isin X forms a loopwith odd total parity (including the parity ofe itself) If any odd loop is found the map is unorientable ifall loops are even the map is orientable ⊓⊔

5 Separator Theorems

Since Lipton and Tarjanrsquos discovery of the planar separatortheorem [14] separator theorems have becomewidely used in algorithms and there has been much work on improved constants for these theorems For-mally we define anǫ-separator of ann-vertex graphG to be a subsetSof the vertices ofG such that eachconnected component ofGShas at mostǫn vertices For graphs embedded on a genus-g orientable surfaceAleksandrov and Djidjev [1] showed that there always existsanǫ-separator with|S| le

radic

(16g + O(1ǫ))nWe combine our tree-cotree decomposition idea with the Lipton-Tarjan method of partitioning the breadthfirst search tree into levels (also used by Aleksandrov and Djidjev) to improve this result and extend it tounorientable surfaces

By Eulerrsquos formula if(T C X) is a tree-cotree decomposition of a map on an orientable surface then|X| = 2g whereg is the genus of the surface on whichM is embedded If the surface is unorientablethen |X| = g Because of this confusion between orientable and unorientable surfaces we prefer to usetheEuler characteristicχ(M) = |X| minus 2 in stating our results In terms ofχ Aleksandrov and Djidjevrsquosresult is that there exists a separator with|S| le

radic

(8χ + O(1ǫ))n We improve this by a factor ofradic

2 to|S| le

radic

(4χ + O(1ǫ))nLet T be a breadth first search tree of the given graph and form a tree-cotree decomposition(T C X)

For any pair of integers 0le i lt k define vertex setsLik andSik as followsLik consists of all verticesvwhose depthd(v) in T satisfiesd(v) equiv i (mod k) Sik is formed by adding toLik a pathPik(v) for eachendpointv of an edge inX wherePik(v) sub T connectsv to the first member ofLik on the path fromv tothe root ofT

Lemma 8 For any i and k G Sik is planar

Proof Extend the depth function on vertices to a continuous function λ M 7rarr R that maps each vertexto its depth maps each edge ofG one-to-one onto the interval between the depths of its endpoints andmaps each cell ofM in such a way that the map has no local minima or maxima in the interior of thecell Partition the surface underlying the mapM into submanifolds with boundary by removing all points

10

x for which λ(x) = i mod k Then each submanifold is formed fromM by cutting certain curves at depthλ(x) = i + ak (for some integera) and certain other curves at depthλ(x) = i + (a+ 1)k If we cap off thesecut curves with disks we form a manifoldMa without boundary Within each of the added disks at depthλ(x) = i + ak add a vertex connected by edges to all the vertices on the boundary of the disk the result isa graphGa embedded inMa such that each edge and vertex inGSik belongs to exactly one of the graphsGa If we let Ta be formed from the union ofT cap Ga with the newly added edges inGa thenTa is a forestdisjoint from the coforestC cap Ga so we can extend these two subgraphs to a tree-cotree decomposition(Tprime

a Cprimea Xprime

a) such thatXprimea sub XcapGa Therefore the pathsPik(v) for v an endpoint of an edge inXcapGa form

a cutset forMa andSik is a cutset for all ofM ⊓⊔

Lemma 9 For any k and any map embedded on a surface with Euler characteristic χsum

0leiltk

|Sik| le n + (χ + 2)k(kminus 1)

Proof Each vertex of the map belongs to exactly one graphLik In addition each of the 2(χ+ 2) endpointsv of edges inX contributes

sum |Pik(v)| =sum

0leiltk i vertices to the total Some vertices may be in more thanone pathPik(v) but this only reduces the total ⊓⊔

Theorem 5 Any n-vertex graph G embedded on a surface with Euler characteristic χ has anǫ-separatorwith |S| le

radic

(4χ + O(1ǫ))n vertices

Proof By choosingi minimizing |Sik| we achieve|Sik| le nk+χk+O(k) The result follows by choosingk =

radic

nχ applying a planar separator theorem to the planar graphG Sik and forming the union of theplanar separator withSik ⊓⊔

If a map representing a characteristic-χ embedding ofG is given as input the method described in theproof of the theorem can be implemented to run in time linear in the size of the map and produces a cutsetof size at most

radic

(4χ + O(1))n The time bound for the overall algorithm and the constant factor in theradic

O(nǫ) term in the separator size depend on the choice of planar separator algorithm used to completethe separator construction

We note that not all loops need always be incorporated inSik in order to makeG Sik planar Forinstance ifG is embedded on a torus it can be cut into a planar graph in the form of a cylinder by removingonly one of the two loops In addition if we chooseSik in such a way that some of the subgraphsTa andC cap Ga described in the proof of Lemma 8 are disconnected then additional edges are removed fromX informing the tree-cotree decompositions ofMa and again we can reduce the number of loops Can we usethese observations to further reduce the constant factor inour separator theorem

6 Low-Diameter Tree Decomposition

In previous work [5] we showed that in a minor-closed graph family the treewidth of a graph with diameterD can be bounded by a function ofD if and only if the family excludes some apex graph For instance forplanar graphs (which exclude the apex graphK5) the treewidth is at most 3D minus O(1) [2] Suchboundedlocal treewidthresults can be used to find efficient solutions to many important algorithmic problems onthese graphs [2459]

In particular any graph embedded on a genusg = O(1) surface has bounded local treewidth since thefamily of such graphs is minor-closed and excludes an apex graph However the treewidth bound from thisgeneral result grows rapidly withg and in this special case we were able to prove a tighter bound

11

Theorem 6 (Eppstein [5])Let G have genus g and diameter D Then G has treewidthO(gD)

The proof relies on showing the existence of a cutset of sizeO(gD) and forming a tree-decompositionby adding this cutset to each node in a tree-decomposition ofthe remaining planar graph However one stepin the proof is to find the minimum cardinality cutset so the proof is nonconstructive and Erickson andSar-Peled [8] later showed that in fact finding minimum cutsets is NP-complete By replacing this step withmethods based on our tree-cotree decomposition we can turnthis nonconstructive proof into an efficientalgorithm

Theorem 7 Let G have genus g and diameter D and suppose that we are givenas input an embeddingMof G on a surface of genus g Then in timeO(gDn) we can find a tree-decomposition of G with treewidthO(gD)

Proof We form a tree-decomposition(T C X) by lettingT be a breadth-first spanning tree ofG and lettingC be any spanning cotree disjoint fromT We then letSbe the set of vertices incident to the edges in loopsloop(T e) | eisin X Each loop has at most 2D edges so|S| = O(gD) andG S is planar so it has a tree-decomposition of treewidth 3DminusO(1) that can be found in timeO(Dn) [2] We form a tree-decompositionof G by addingS to each node in the tree-decomposition ofG S ⊓⊔

TheO(gDn) time bound is optimal in the sense that it is the size of an explicit representation of theresulting tree-decomposition but if we represent the setsof vertices at each tree-decomposition node im-plicitly as a union of a constant number of paths in the two treesT andB the time can be reduced to linearin the size of the input mapM

7 Conclusions

We have shown how the tree-cotree decomposition can be used in several applications for graphs embeddedon surfaces maintaining dynamic properties of the graph computing separators and constructing tree-decompositions of small treewidth There are many other important planar graph algorithms that can begeneralized to graphs embedded on surfaces and it would be interesting to see which others of these can beimproved by the use of our tree-cotree decomposition methods

Acknowledgements

This research was supported in part by NSF grant CCR-9912338

References

1 L Aleksandrov and H Djidjev Linear algorithms for partitioning embedded graphs of bounded genusSIAM J DiscreteMath9129ndash150 1996 httpwwwdcswarwickacuksimhristopapersgenus-separatorpsZ

2 B S Baker Approximation algorithms for NP-complete problems on planar graphsJ Assoc Comput Mach41153ndash1801994

3 C P Bonnington and C H C LittleThe Foundations of Topological Graph Theory Springer-Verlag 19954 D Eppstein Subgraph isomorphism in planar graphs and related problemsJ Graph Algorithms amp Applications3(3)1ndash27

1999 arXivcsDS99110035 D Eppstein Diameter and treewidth in minor-closed graph familiesAlgorithmica27275ndash291 2000

httplinkspringer-nycomlinkservicejournals00453contents0010020 arXivmathCO99071266 D Eppstein Z Galil G F Italiano and T H Spencer Separator based sparsification I planarity testing and minimum

spanning treesJ Computing amp Systems Sciences52(1)3ndash27 February 19967 D Eppstein G F Italiano R Tamassia R E Tarjan J R Westbrook and M Yung Maintenance of a minimum spanning

forest in a dynamic planar graphJ Algorithms13(1)33ndash54 March 1992

12

8 J Erickson and S Har-Peled Optimally cutting a surfaceinto a diskProc 18th ACM Symp Computational Geometrypp 244ndash253 June 2002 httpcompgeomcsuiucedusimjeffepubsschemahtml arXivcsCG0207004

9 M Grohe Local tree-width excluded minors and approximation algorithms arXivorg e-Print archive January 2000arXivmathCO0001128

10 J L Gross and T W TuckerTopological Graph Theory Dover Publications 200111 M R Henzinger and V King Randomized fully dynamic graph algorithms with polylogarithmic time per operationJ ACM

46(4)502ndash536 July 199912 J Holm K de Lichtenberg and M Thorup Poly-logarithmic deterministic fully-dynamic graph algorithms for connectivity

minimum spanning tree 2-edge and biconnectivityJ ACM48(4)723ndash760 July 200113 S Lins Graph-encoded mapsJ Combinatorial Theory Ser B32171ndash181 198214 R Lipton and R E Tarjan A separator theorem for planargraphsSIAM J Applied Math36(2)177ndash189 April 197915 D D Sleator and R E Tarjan A data structure for dynamic treesJ Computing amp Systems Sciences26362ndash391 198316 D A Spielman and S-H Teng Disk packings and planar separatorsProc 12th ACM Symp Computational Geometry

pp 349ndash358 1996 httpwww-mathmitedusimspielmanResearchseparatorhtml17 J StillwellClassical Topology and Combinatorial Group Theory Graduate Texts in Mathematics 72 Springer-Verlag 2nd

edition 199318 M Thorup Near-optimal fully-dynamic graph connectivity Proc 32nd ACM Symp Theory of Computing pp 343ndash350 May

200019 G Vegter and C-K Yap Computational complexity of combinatorial surfacesProc 6th ACM Symp Computational

Geometry pp 102ndash111 1990 httpwwwacmorgpubscitationsproceedingscompgeom98524p102-vegter

13

Page 5: Dynamic Generators of Topologically Embedded Graphs

to behomotopy equivalentif there exists a continuous functionf [0 1]2 7rarr Ssuch thatf (x i) = fi(x) andf (0 i) = f (1 i) = x0 Define theproductof two loopsf0 andf1 to be the loop

f (x) =

f0(2x) for 0 le x le 12f1(2xminus 1) for 12 le x le 1

Then it can be shown that homotopy equivalence is an equivalence relation and that the homotopy equiv-alence classes of loops form a group thefundamental group under homotopy equivalence In this groupinverses can be found by reversing the direction of a loop iff is a loopg(x) = f (1minus x) is a loop inverse tof A set of loops is said togeneratethe fundamental group if every other equivalence class of loops can bereached by products of these generators and their inverses

If we are given a rooted treeT and oriented edgee isin T with the base pointx0 of the fundamental loopat the root ofT we can define a loop loop(T e) by following a path inT from x0 to the head ofe thentraversing edgee to its tail and finally following a path inT from that tail back tox0 When consideringthese loops as generators of the fundamental group the orientation ofe is unimportant since reversing theedge merely produces the inverse group element

Lemma 2 Let (T C X) be a tree-cotree decomposition of mapM Then the loopsloop(T e) | e isin Xgenerate the fundamental group of the surface on whichM is embedded

Proof Contract the edges inT into the rootx0 of T while leaving the surface unchanged outside of a smallneighborhood ofT this contraction does not change the fundamental group of the surface In the contractedimage the loops from the statement of the lemma are each contracted into a single edge connectingx0 toitself Decompose the surface into a setS1 consisting of a small neighborhood of the set of these contractedloops and a setS2 consisting of the faces of the map and the cotree edges inC Then by the Seifert ndash VanKampen theorem [17 Section 34] the fundamental group of the overall surface can be formed by combiningthe generators and relations of the fundamental groups of these two pieces with additional relations describ-ing the way these two pieces fit togetherS1 can be contracted to a graph with one vertex and|X| self-loopswhich has a fundamental group with each of these loops as generators and no relationsS2 is topologicallya disk (since it consists of a collection of disk faces glued together in the pattern of a tree) so it has a trivialfundamental group The fundamental group of the overall surface then is generated by the loops describedin the statement of the lemma with a single relation formed by the concatenation of these loops around theboundary ofS2 ⊓⊔

Of course for any treeT the loopsloop(T e) | e isin T also generate the fundamental group butin general this will form a much larger system of generatorsThe advantage of the system of generatorsprovided by Lemma 2 is its small cardinality proportional to the genus of the surface

The same tree-contraction argument used in Lemma 2 also shows that the edges in the loopsloop(T e) |eisin X form a cutset

4 Dynamic Generators

41 Update Operations

Following [7] we allow four types of update operation insertion of a new edge between two verticesdeletion of an edge dual edge insertion (expansion) and dual edge deletion (contraction) The effect ofthese updates on the gem representation is shown in Figure 2

The location of an edge insertion can be specified by a pair of gem verticesp andq shown as shadedtriangles in the figure We then subdivide the two gem edgesSE(p) andSE(q) into paths ofSE andSC edgespreserving the connectivity of theSE-SC cycles representing vertices in the gem and create a new graph

5

Fig 2 Effects of edge insertion and deletion and their duals on thegem representation

edge (represented in the gem by a 4-cycle ofSV andSC edges) using theSC edges of the subdivided pathsin such a way that the new gem edgesSE(p) andSE(q) are adjacent to a common edge of typeSV

In the most typical case of an edge insertion (Fig 2 upper right) the two edgesSE(p) andSE(q) aredistinct each of these edges is subdivided into a three-edge path and the two new vertices on each path areconnected in pairs by newSV edges We distinguish three subcases of this operation depending on whichcells of the map contain the endpoints of the inserted edge

ndash In a cell-merging insertion the two endpoints of the inserted edge are attached into distinct cells ofthe map that is the two gem edgesSE(p) andSE(q) belong to distinctSE-SV cycles The effect of theinsertion is to split each of these two cycles into paths andto splice these two paths together into asingle cycle via the newly createdSV edges We are increasing the number of edges and decreasing thenumber of cells so the surfacersquos genus increases Topologically this can be viewed as gluing a handlebetween the two cells and routing the new edge along this handle

ndash In acell-splitting insertion the two endpoints of the inserted edge belong to a single cell of the map andif the SE-SV cycle representing this cell is consistently oriented then SE(p) andSE(q) both point towardsor both point away from their endpointsp andq respectively The effect of the insertion is to split theSE-SV cycle into two paths and then reconnect the paths into two cycles forming two cells connectedacross the new edge We are increasing both the number of edges and the number of cells so the genusand the topology of the surface are preserved This was the only type of edge insertion allowed in [7]

ndash In acell-twisting insertion the two endpoints of the inserted edge belong to a single cell of the map butSE(p) andSE(q) are not consistently oriented The effect of the insertion is to split theSE-SV cycle intotwo paths and then reconnect the paths into a single cycle with the orientation of the two paths reversedfrom their previous situation We are increasing the numberof edges while preserving the number ofcells so the genus increases Topologically this can be viewed as gluing a crosscap into the cell androuting the new edge through it

Each of these types of insertion has a complementary deletion specified by the edge to be deleted whichwe call acell-splitting deletion acell-merging deletion or anuntwisting deletionrespectively In addition

6

we allow the dual operations to insertions and deletions asshown on the upper right of the figure dualdeletion is more familiar as the operation of edge contraction The dual of a cell-merging insertion mergestwo vertices of the graph while increasing the genus the dual of a cell-splitting insertion splits a vertexinto two adjacent vertices and the dual of a cell-twisting insertion changes the order of the edges and cellsaround a vertex We do not describe these in detail because our data structure will be self-dual so that eachdual operation is performed exactly as the primal operationsubstitutingSV for SC and vice versa

Finally it is possible to specify an insertion in whichSE(p) andSE(q) are not distinct Ifp 6= q whileSE(p) = SE(q) (Fig 2 lower left) we subdivideSE into a path of five edges and connect the four new gemvertices into anSV-SC cycle in such a way that adjacent vertices of the cycle are connected top andq Thiscan be viewed as a special case of a cell-splitting insertionin which the two endpoints of the inserted edgeare placed next to each other at the same vertex creating a one-sided cell contained within the previouslyexisting cell The dual of this operation adds a new degree-one vertex to the graph

If p = q we perform an edge insertion by again subdividingSE into a path of five edges and connectingthe four new gem vertices into anSV-SC cycle in such a way that opposite vertices of the cycle are connectedto p and the other endpoint ofSE(p) Edge insertion withp = q and dual edge insertion withp = q producethe same result shown in the lower right of Fig 2 This can beviewed as a special case of a cell-twistinginsertion in which the two endpoints of the inserted edge areplaced next to each other at the same vertex

42 Simple Dynamic Generators

We now describe a simple scheme for maintaining generators and minimum spanning trees in dynamic mapsbased on the dynamic planar graph algorithms of Eppstein et al [7] We will later show how to improve thetime bounds for this scheme at the expense of some additionalcomplexity

Theorem 1 Let M be a map with distinct edge weights changing according to the update operationsdescribed in the previous section as well as by changes to theweights of the edges Then in timeO(g logn)per update we can maintain a tree-cotree decomposition(T C X) where T is the minimum spanning treeC is the maximum spanning cotree and g is the genus of the map at the time of the update operation

Proof We representT by Sleator and Tarjanrsquos dynamic tree data structure [15] modified as in [7] to supportedge contraction and expansion operations as well as the more usual edge insertions and deletions We use asimilar data structure to represent the dual treeClowast With this data structure we can find in logarithmic timethe longest edge on any path ofT or the shortest edge on any path ofClowast We can also test in logarithmic timewhether a pair of edgese eprime forms aswap that is whetherTe eprime (where denotes the set-theoreticsymmetric difference) is another spanning tree ofT We also maintain the tree data structures discussed inSection 2 for the adjacency lists of each vertex and face ofM which allow us to classify the type of aninsertion or deletion in logarithmic time

To increase the weight of an edgee in T cup X we first test whether the increased weight causes the edgeto move to the maximum cotreeC by finding the shortest edgeeprime on the dual path connecting the endpointsof elowast and testing whether the dual swape eprime increases the weight ofC If so we adde to C and moveeprime

to X We then searchX for the minimum weight edgeeprimeprime forming a swape eprimeprime in T and testing whetherthis swap causes an improvement in the weight ofT If it does we addeprimeprime to T and movee to X Lemma 1shows that after these steps we must again have a tree-cotree partition To decrease the weight of an edgeein Ccup X we perform a similar sequence of steps on the dual tree-cotree-partition(Clowast Tlowast Xlowast)

We now describe the effect on our data structure of the various insertion and deletion operations Theedge expansions and contractions are performed by very similar sequences of steps in the dual map

ndash To perform a cell-merging insertion of an edgee we find the lightest edgeeprime on the dual path inClowast

connecting the merged cells and place botheandeprime in X We then perform swaps similar to those for a

7

weight change to determine whethere should move intoT or C To perform a cell-splitting deletion ofe we searchX for the heaviest edgeeprime connecting the two components ofClowast formed by the split andmoveeprime into C

ndash To perform a cell-splitting insertion of an edgee we adde to X searchX for the heaviest edgeeprime

connecting the two components ofClowast formed by the split and perform swaps similar to those for aweight change to determine whether to movee into T or C To perform a cell-merging deletion ofewe increase the weight ofe until it belongs toC then remove it from the graph and merge its two dualendpoints

ndash To perform a cell-twisting insertion of an edgee we simply adde to X search for the best swape eprimewith eprime isin T and perform this swap if it improves the weight ofT The inserted edgeecan not belong toC sinceelowast connects a dual vertex to itself To perform an untwisting deletion we test whetherebelongsto T and if so swap it with the best replacementeprime isin X before removing it

Each of these operations maintains the desired partition via a sequence ofO(g) dynamic tree queriesand updates so the total time per change toM isO(g logn) ⊓⊔

If we wish to maintain a tree-cotree decomposition of a graphwithout weights we can choose weightsfor the edges arbitrarily

43 Improved Dynamic Generators

The bottleneck of Theorem 1 is the search for swaps in graphsT cup X or Clowast cup Xlowast performing this search bytesting each edge inXlowast takes timeO(g logn) We can improve this by using the method of separator basedsparsification [6] to replaceT andClowast by contracted treesTprime andCprime that match theO(g) size ofX and thenapplying a general dynamic graph connectivity algorithm [12 18] to find the swaps in the smaller graphsTprime cup X or Cprime cup Xlowast

Specifically we formTprime from T by repeated edge contractions forming a sequence of treesT0 =T T1 Tk = Tprime If Ti contains a vertex with degree one that is not an endpoint of anedge inX wedelete that vertex and its adjacent edge to formTi+1 Otherwise ifTi contains a vertex with degree two thatis not an endpoint of an edge inX let e andeprime be the two edges incident to that vertex we formTi+1 bycontracting whichever ofe andeprime has the smaller weight The construction ofCprime from Clowast is essentially thesame except that we contract the larger weight of two edges incident to any degree two vertex

Lemma 3 The trees Tprime and Cprime described above haveO(|X|) edges and do not depend on the order inwhich the contractions are performed

Proof Consider the set of paths inT connecting endpoints ofX The union of these paths forms a subtreeTprimeprime

of T Then an alternative description ofTprime is that it consists of one edge for each path of degree-two verticesin Tprimeprime with the weight of this edge equal to the maximum weight of anedge in the path Specifically eachdeletion of a degree one vertex removes an edge that is not inTprimeprime and each contraction of a degree twovertex reduces the length of one of the paths inTprimeprime without changing the maximum weight of an edge on thepath This proves the assertion thatTprime is independent of the contraction order it hasO(|X|) edges becauseit has at most|X| leaves and no internal degree-two vertices ⊓⊔

Lemma 4 Trees Tprime and Cprime can be updated after any change to T or Clowast in timeO(logn) per change Eachchange to T C or X causesO(1) edges to change in Tprime and Cprime

Proof We use the following data structures forT First we use a dynamic tree data structure [15] that canfind the maximum weight edge on any path ofT and that can determine for any three query vertices ofT

8

which vertex forms the branching point between the paths connecting the three vertex Second we maintainan Euler tour data structure [11] that can find for a query vertex in T the one or two nearest vertices thatbelong toTprime Whenever a change toX adds a vertexv to the set of endpoints inX we must also addvto Tprime we do this by querying the Euler tour data structure to find the edge or vertex ofTprime at which thebranch tov should be added querying the dynamic tree data structure tofind the correct branching point onthat edge giving the overall graph structure of the new treeTprime and finally querying the dynamic tree datastructure again to find the weights of the changed edges inTprime To remove a vertex from the endpoints inXwe simply contract one or two edges as necessary inTprime To perform a swap inT we use the data structuresas described above to make all swap endpoints part ofTprime perform the swap and then contract edges toremove unnecessary vertices from the changedTprime The updates toCprime are similar ⊓⊔

Lemma 5 Let e be an edge of T that was not contracted in forming Tprime and let eprime be an edge of X Thene eprime is a swap in T if and only if it is a swap in Tprime

Lemma 6 Let eprime be an edge in X and let e be the heaviest edge forming a swape eprime in T Then e is notcontracted in forming Tprime

Theorem 2 Let M be a map with distinct edge weights changing according to the update operationsdescribed in the previous section as well as by changes to theweights of the edges Then in amortizedtimeO(logn + (logg)4) per update we can maintain a tree-cotree decomposition(T C X) where T is theminimum spanning tree C is the maximum spanning cotree andg is the genus of the map at the time of theupdate operation

Proof The overall algorithm is the same as the one in Theorem 1 but we use the data structures describedabove to maintain treesTprime andCprime and use the dynamic minimum spanning tree data structure ofHolm etal [12] to find the edgeeprime isin X forming the best swap for any edgeeisin T or elowast isin Clowast The time bound followsfrom plugging theO(|X|) bound on the number of edges inTprime cup X andCprime cup Xlowast into the time bound forthe minimum spanning tree data structure and using this bound to replace theO(g logn) time for findingreplacement edges in Theorem 1 ⊓⊔

The final improvement to our bounds comes from the observation that if we only wish to maintain atree-cotree decomposition for a graph without weights then we can replace the dynamic minimum spanningtree data structures forTprime cup X andCprime cup X with any dynamic connectivity data structure that maintains aspanning tree of these two dynamic graphs and changes the tree by a single swap per update to the graphsThe connectivity structure of Holm et al [12] as improved byThorup [18] is a suitable replacement

Theorem 3 Let M be a map with distinct edge weights changing according to the update operationsdescribed in the previous section as well as by changes to theweights of the edges Then in amortized timeO(logn + logg(log logg)3) per update we can maintain a tree-cotree decomposition(T C X) where g isthe genus of the map at the time of the update operation

44 Orientability

The results above are nearly sufficient to determine the surface underlying the dynamic mapM since itis known that 2-dimensional closed surfaces are classified by two quantities their genus (which we cancalculate from|X|) and theorientability of the surface We can compute the orientability from the followingsimple result which follows from the fact that the loops generated by edges inX form a cutset

9

Lemma 7 LetM have a tree-cotree decomposition(T C X) Then The surface on whichM is embeddedis unorientable if and only if every sufficiently small neighborhood of at least one of the loopsloop(T e) |eisin X is homeomorphic to a Mobius strip

Theorem 4 Let M be a map with distinct edge weights changing according to the update operationsdescribed in the previous section as well as by changes to theweights of the edges Then in amortized timeO(logn+ logg(log logg)3) per update we can determine after each update whether the surface underlyingthe map is orientable

Proof For any path inM we can form a sufficiently small neighborhood of the path by gluing togethera collection of disks where each disk has as its boundary thegem cycle representing a vertex or edge inthe path We choose an arbitrary clockwise orientation for the gem cycle representing each vertex inMand augment the Sleator-Tarjan dynamic tree data structureused to maintain the treeT in the tree-cotreedecomposition(T C X) by storing an extra bit per tree edge that is zero when the edgersquos preserves thechosen orientations of its two endpoints and one when it reverses these orientations we can use the dynamictree data structure to determine the parity of the sum of these bits along any path inT After each changeto the tree-cotree decomposition we use this data structure to determine whether anye isin X forms a loopwith odd total parity (including the parity ofe itself) If any odd loop is found the map is unorientable ifall loops are even the map is orientable ⊓⊔

5 Separator Theorems

Since Lipton and Tarjanrsquos discovery of the planar separatortheorem [14] separator theorems have becomewidely used in algorithms and there has been much work on improved constants for these theorems For-mally we define anǫ-separator of ann-vertex graphG to be a subsetSof the vertices ofG such that eachconnected component ofGShas at mostǫn vertices For graphs embedded on a genus-g orientable surfaceAleksandrov and Djidjev [1] showed that there always existsanǫ-separator with|S| le

radic

(16g + O(1ǫ))nWe combine our tree-cotree decomposition idea with the Lipton-Tarjan method of partitioning the breadthfirst search tree into levels (also used by Aleksandrov and Djidjev) to improve this result and extend it tounorientable surfaces

By Eulerrsquos formula if(T C X) is a tree-cotree decomposition of a map on an orientable surface then|X| = 2g whereg is the genus of the surface on whichM is embedded If the surface is unorientablethen |X| = g Because of this confusion between orientable and unorientable surfaces we prefer to usetheEuler characteristicχ(M) = |X| minus 2 in stating our results In terms ofχ Aleksandrov and Djidjevrsquosresult is that there exists a separator with|S| le

radic

(8χ + O(1ǫ))n We improve this by a factor ofradic

2 to|S| le

radic

(4χ + O(1ǫ))nLet T be a breadth first search tree of the given graph and form a tree-cotree decomposition(T C X)

For any pair of integers 0le i lt k define vertex setsLik andSik as followsLik consists of all verticesvwhose depthd(v) in T satisfiesd(v) equiv i (mod k) Sik is formed by adding toLik a pathPik(v) for eachendpointv of an edge inX wherePik(v) sub T connectsv to the first member ofLik on the path fromv tothe root ofT

Lemma 8 For any i and k G Sik is planar

Proof Extend the depth function on vertices to a continuous function λ M 7rarr R that maps each vertexto its depth maps each edge ofG one-to-one onto the interval between the depths of its endpoints andmaps each cell ofM in such a way that the map has no local minima or maxima in the interior of thecell Partition the surface underlying the mapM into submanifolds with boundary by removing all points

10

x for which λ(x) = i mod k Then each submanifold is formed fromM by cutting certain curves at depthλ(x) = i + ak (for some integera) and certain other curves at depthλ(x) = i + (a+ 1)k If we cap off thesecut curves with disks we form a manifoldMa without boundary Within each of the added disks at depthλ(x) = i + ak add a vertex connected by edges to all the vertices on the boundary of the disk the result isa graphGa embedded inMa such that each edge and vertex inGSik belongs to exactly one of the graphsGa If we let Ta be formed from the union ofT cap Ga with the newly added edges inGa thenTa is a forestdisjoint from the coforestC cap Ga so we can extend these two subgraphs to a tree-cotree decomposition(Tprime

a Cprimea Xprime

a) such thatXprimea sub XcapGa Therefore the pathsPik(v) for v an endpoint of an edge inXcapGa form

a cutset forMa andSik is a cutset for all ofM ⊓⊔

Lemma 9 For any k and any map embedded on a surface with Euler characteristic χsum

0leiltk

|Sik| le n + (χ + 2)k(kminus 1)

Proof Each vertex of the map belongs to exactly one graphLik In addition each of the 2(χ+ 2) endpointsv of edges inX contributes

sum |Pik(v)| =sum

0leiltk i vertices to the total Some vertices may be in more thanone pathPik(v) but this only reduces the total ⊓⊔

Theorem 5 Any n-vertex graph G embedded on a surface with Euler characteristic χ has anǫ-separatorwith |S| le

radic

(4χ + O(1ǫ))n vertices

Proof By choosingi minimizing |Sik| we achieve|Sik| le nk+χk+O(k) The result follows by choosingk =

radic

nχ applying a planar separator theorem to the planar graphG Sik and forming the union of theplanar separator withSik ⊓⊔

If a map representing a characteristic-χ embedding ofG is given as input the method described in theproof of the theorem can be implemented to run in time linear in the size of the map and produces a cutsetof size at most

radic

(4χ + O(1))n The time bound for the overall algorithm and the constant factor in theradic

O(nǫ) term in the separator size depend on the choice of planar separator algorithm used to completethe separator construction

We note that not all loops need always be incorporated inSik in order to makeG Sik planar Forinstance ifG is embedded on a torus it can be cut into a planar graph in the form of a cylinder by removingonly one of the two loops In addition if we chooseSik in such a way that some of the subgraphsTa andC cap Ga described in the proof of Lemma 8 are disconnected then additional edges are removed fromX informing the tree-cotree decompositions ofMa and again we can reduce the number of loops Can we usethese observations to further reduce the constant factor inour separator theorem

6 Low-Diameter Tree Decomposition

In previous work [5] we showed that in a minor-closed graph family the treewidth of a graph with diameterD can be bounded by a function ofD if and only if the family excludes some apex graph For instance forplanar graphs (which exclude the apex graphK5) the treewidth is at most 3D minus O(1) [2] Suchboundedlocal treewidthresults can be used to find efficient solutions to many important algorithmic problems onthese graphs [2459]

In particular any graph embedded on a genusg = O(1) surface has bounded local treewidth since thefamily of such graphs is minor-closed and excludes an apex graph However the treewidth bound from thisgeneral result grows rapidly withg and in this special case we were able to prove a tighter bound

11

Theorem 6 (Eppstein [5])Let G have genus g and diameter D Then G has treewidthO(gD)

The proof relies on showing the existence of a cutset of sizeO(gD) and forming a tree-decompositionby adding this cutset to each node in a tree-decomposition ofthe remaining planar graph However one stepin the proof is to find the minimum cardinality cutset so the proof is nonconstructive and Erickson andSar-Peled [8] later showed that in fact finding minimum cutsets is NP-complete By replacing this step withmethods based on our tree-cotree decomposition we can turnthis nonconstructive proof into an efficientalgorithm

Theorem 7 Let G have genus g and diameter D and suppose that we are givenas input an embeddingMof G on a surface of genus g Then in timeO(gDn) we can find a tree-decomposition of G with treewidthO(gD)

Proof We form a tree-decomposition(T C X) by lettingT be a breadth-first spanning tree ofG and lettingC be any spanning cotree disjoint fromT We then letSbe the set of vertices incident to the edges in loopsloop(T e) | eisin X Each loop has at most 2D edges so|S| = O(gD) andG S is planar so it has a tree-decomposition of treewidth 3DminusO(1) that can be found in timeO(Dn) [2] We form a tree-decompositionof G by addingS to each node in the tree-decomposition ofG S ⊓⊔

TheO(gDn) time bound is optimal in the sense that it is the size of an explicit representation of theresulting tree-decomposition but if we represent the setsof vertices at each tree-decomposition node im-plicitly as a union of a constant number of paths in the two treesT andB the time can be reduced to linearin the size of the input mapM

7 Conclusions

We have shown how the tree-cotree decomposition can be used in several applications for graphs embeddedon surfaces maintaining dynamic properties of the graph computing separators and constructing tree-decompositions of small treewidth There are many other important planar graph algorithms that can begeneralized to graphs embedded on surfaces and it would be interesting to see which others of these can beimproved by the use of our tree-cotree decomposition methods

Acknowledgements

This research was supported in part by NSF grant CCR-9912338

References

1 L Aleksandrov and H Djidjev Linear algorithms for partitioning embedded graphs of bounded genusSIAM J DiscreteMath9129ndash150 1996 httpwwwdcswarwickacuksimhristopapersgenus-separatorpsZ

2 B S Baker Approximation algorithms for NP-complete problems on planar graphsJ Assoc Comput Mach41153ndash1801994

3 C P Bonnington and C H C LittleThe Foundations of Topological Graph Theory Springer-Verlag 19954 D Eppstein Subgraph isomorphism in planar graphs and related problemsJ Graph Algorithms amp Applications3(3)1ndash27

1999 arXivcsDS99110035 D Eppstein Diameter and treewidth in minor-closed graph familiesAlgorithmica27275ndash291 2000

httplinkspringer-nycomlinkservicejournals00453contents0010020 arXivmathCO99071266 D Eppstein Z Galil G F Italiano and T H Spencer Separator based sparsification I planarity testing and minimum

spanning treesJ Computing amp Systems Sciences52(1)3ndash27 February 19967 D Eppstein G F Italiano R Tamassia R E Tarjan J R Westbrook and M Yung Maintenance of a minimum spanning

forest in a dynamic planar graphJ Algorithms13(1)33ndash54 March 1992

12

8 J Erickson and S Har-Peled Optimally cutting a surfaceinto a diskProc 18th ACM Symp Computational Geometrypp 244ndash253 June 2002 httpcompgeomcsuiucedusimjeffepubsschemahtml arXivcsCG0207004

9 M Grohe Local tree-width excluded minors and approximation algorithms arXivorg e-Print archive January 2000arXivmathCO0001128

10 J L Gross and T W TuckerTopological Graph Theory Dover Publications 200111 M R Henzinger and V King Randomized fully dynamic graph algorithms with polylogarithmic time per operationJ ACM

46(4)502ndash536 July 199912 J Holm K de Lichtenberg and M Thorup Poly-logarithmic deterministic fully-dynamic graph algorithms for connectivity

minimum spanning tree 2-edge and biconnectivityJ ACM48(4)723ndash760 July 200113 S Lins Graph-encoded mapsJ Combinatorial Theory Ser B32171ndash181 198214 R Lipton and R E Tarjan A separator theorem for planargraphsSIAM J Applied Math36(2)177ndash189 April 197915 D D Sleator and R E Tarjan A data structure for dynamic treesJ Computing amp Systems Sciences26362ndash391 198316 D A Spielman and S-H Teng Disk packings and planar separatorsProc 12th ACM Symp Computational Geometry

pp 349ndash358 1996 httpwww-mathmitedusimspielmanResearchseparatorhtml17 J StillwellClassical Topology and Combinatorial Group Theory Graduate Texts in Mathematics 72 Springer-Verlag 2nd

edition 199318 M Thorup Near-optimal fully-dynamic graph connectivity Proc 32nd ACM Symp Theory of Computing pp 343ndash350 May

200019 G Vegter and C-K Yap Computational complexity of combinatorial surfacesProc 6th ACM Symp Computational

Geometry pp 102ndash111 1990 httpwwwacmorgpubscitationsproceedingscompgeom98524p102-vegter

13

Page 6: Dynamic Generators of Topologically Embedded Graphs

Fig 2 Effects of edge insertion and deletion and their duals on thegem representation

edge (represented in the gem by a 4-cycle ofSV andSC edges) using theSC edges of the subdivided pathsin such a way that the new gem edgesSE(p) andSE(q) are adjacent to a common edge of typeSV

In the most typical case of an edge insertion (Fig 2 upper right) the two edgesSE(p) andSE(q) aredistinct each of these edges is subdivided into a three-edge path and the two new vertices on each path areconnected in pairs by newSV edges We distinguish three subcases of this operation depending on whichcells of the map contain the endpoints of the inserted edge

ndash In a cell-merging insertion the two endpoints of the inserted edge are attached into distinct cells ofthe map that is the two gem edgesSE(p) andSE(q) belong to distinctSE-SV cycles The effect of theinsertion is to split each of these two cycles into paths andto splice these two paths together into asingle cycle via the newly createdSV edges We are increasing the number of edges and decreasing thenumber of cells so the surfacersquos genus increases Topologically this can be viewed as gluing a handlebetween the two cells and routing the new edge along this handle

ndash In acell-splitting insertion the two endpoints of the inserted edge belong to a single cell of the map andif the SE-SV cycle representing this cell is consistently oriented then SE(p) andSE(q) both point towardsor both point away from their endpointsp andq respectively The effect of the insertion is to split theSE-SV cycle into two paths and then reconnect the paths into two cycles forming two cells connectedacross the new edge We are increasing both the number of edges and the number of cells so the genusand the topology of the surface are preserved This was the only type of edge insertion allowed in [7]

ndash In acell-twisting insertion the two endpoints of the inserted edge belong to a single cell of the map butSE(p) andSE(q) are not consistently oriented The effect of the insertion is to split theSE-SV cycle intotwo paths and then reconnect the paths into a single cycle with the orientation of the two paths reversedfrom their previous situation We are increasing the numberof edges while preserving the number ofcells so the genus increases Topologically this can be viewed as gluing a crosscap into the cell androuting the new edge through it

Each of these types of insertion has a complementary deletion specified by the edge to be deleted whichwe call acell-splitting deletion acell-merging deletion or anuntwisting deletionrespectively In addition

6

we allow the dual operations to insertions and deletions asshown on the upper right of the figure dualdeletion is more familiar as the operation of edge contraction The dual of a cell-merging insertion mergestwo vertices of the graph while increasing the genus the dual of a cell-splitting insertion splits a vertexinto two adjacent vertices and the dual of a cell-twisting insertion changes the order of the edges and cellsaround a vertex We do not describe these in detail because our data structure will be self-dual so that eachdual operation is performed exactly as the primal operationsubstitutingSV for SC and vice versa

Finally it is possible to specify an insertion in whichSE(p) andSE(q) are not distinct Ifp 6= q whileSE(p) = SE(q) (Fig 2 lower left) we subdivideSE into a path of five edges and connect the four new gemvertices into anSV-SC cycle in such a way that adjacent vertices of the cycle are connected top andq Thiscan be viewed as a special case of a cell-splitting insertionin which the two endpoints of the inserted edgeare placed next to each other at the same vertex creating a one-sided cell contained within the previouslyexisting cell The dual of this operation adds a new degree-one vertex to the graph

If p = q we perform an edge insertion by again subdividingSE into a path of five edges and connectingthe four new gem vertices into anSV-SC cycle in such a way that opposite vertices of the cycle are connectedto p and the other endpoint ofSE(p) Edge insertion withp = q and dual edge insertion withp = q producethe same result shown in the lower right of Fig 2 This can beviewed as a special case of a cell-twistinginsertion in which the two endpoints of the inserted edge areplaced next to each other at the same vertex

42 Simple Dynamic Generators

We now describe a simple scheme for maintaining generators and minimum spanning trees in dynamic mapsbased on the dynamic planar graph algorithms of Eppstein et al [7] We will later show how to improve thetime bounds for this scheme at the expense of some additionalcomplexity

Theorem 1 Let M be a map with distinct edge weights changing according to the update operationsdescribed in the previous section as well as by changes to theweights of the edges Then in timeO(g logn)per update we can maintain a tree-cotree decomposition(T C X) where T is the minimum spanning treeC is the maximum spanning cotree and g is the genus of the map at the time of the update operation

Proof We representT by Sleator and Tarjanrsquos dynamic tree data structure [15] modified as in [7] to supportedge contraction and expansion operations as well as the more usual edge insertions and deletions We use asimilar data structure to represent the dual treeClowast With this data structure we can find in logarithmic timethe longest edge on any path ofT or the shortest edge on any path ofClowast We can also test in logarithmic timewhether a pair of edgese eprime forms aswap that is whetherTe eprime (where denotes the set-theoreticsymmetric difference) is another spanning tree ofT We also maintain the tree data structures discussed inSection 2 for the adjacency lists of each vertex and face ofM which allow us to classify the type of aninsertion or deletion in logarithmic time

To increase the weight of an edgee in T cup X we first test whether the increased weight causes the edgeto move to the maximum cotreeC by finding the shortest edgeeprime on the dual path connecting the endpointsof elowast and testing whether the dual swape eprime increases the weight ofC If so we adde to C and moveeprime

to X We then searchX for the minimum weight edgeeprimeprime forming a swape eprimeprime in T and testing whetherthis swap causes an improvement in the weight ofT If it does we addeprimeprime to T and movee to X Lemma 1shows that after these steps we must again have a tree-cotree partition To decrease the weight of an edgeein Ccup X we perform a similar sequence of steps on the dual tree-cotree-partition(Clowast Tlowast Xlowast)

We now describe the effect on our data structure of the various insertion and deletion operations Theedge expansions and contractions are performed by very similar sequences of steps in the dual map

ndash To perform a cell-merging insertion of an edgee we find the lightest edgeeprime on the dual path inClowast

connecting the merged cells and place botheandeprime in X We then perform swaps similar to those for a

7

weight change to determine whethere should move intoT or C To perform a cell-splitting deletion ofe we searchX for the heaviest edgeeprime connecting the two components ofClowast formed by the split andmoveeprime into C

ndash To perform a cell-splitting insertion of an edgee we adde to X searchX for the heaviest edgeeprime

connecting the two components ofClowast formed by the split and perform swaps similar to those for aweight change to determine whether to movee into T or C To perform a cell-merging deletion ofewe increase the weight ofe until it belongs toC then remove it from the graph and merge its two dualendpoints

ndash To perform a cell-twisting insertion of an edgee we simply adde to X search for the best swape eprimewith eprime isin T and perform this swap if it improves the weight ofT The inserted edgeecan not belong toC sinceelowast connects a dual vertex to itself To perform an untwisting deletion we test whetherebelongsto T and if so swap it with the best replacementeprime isin X before removing it

Each of these operations maintains the desired partition via a sequence ofO(g) dynamic tree queriesand updates so the total time per change toM isO(g logn) ⊓⊔

If we wish to maintain a tree-cotree decomposition of a graphwithout weights we can choose weightsfor the edges arbitrarily

43 Improved Dynamic Generators

The bottleneck of Theorem 1 is the search for swaps in graphsT cup X or Clowast cup Xlowast performing this search bytesting each edge inXlowast takes timeO(g logn) We can improve this by using the method of separator basedsparsification [6] to replaceT andClowast by contracted treesTprime andCprime that match theO(g) size ofX and thenapplying a general dynamic graph connectivity algorithm [12 18] to find the swaps in the smaller graphsTprime cup X or Cprime cup Xlowast

Specifically we formTprime from T by repeated edge contractions forming a sequence of treesT0 =T T1 Tk = Tprime If Ti contains a vertex with degree one that is not an endpoint of anedge inX wedelete that vertex and its adjacent edge to formTi+1 Otherwise ifTi contains a vertex with degree two thatis not an endpoint of an edge inX let e andeprime be the two edges incident to that vertex we formTi+1 bycontracting whichever ofe andeprime has the smaller weight The construction ofCprime from Clowast is essentially thesame except that we contract the larger weight of two edges incident to any degree two vertex

Lemma 3 The trees Tprime and Cprime described above haveO(|X|) edges and do not depend on the order inwhich the contractions are performed

Proof Consider the set of paths inT connecting endpoints ofX The union of these paths forms a subtreeTprimeprime

of T Then an alternative description ofTprime is that it consists of one edge for each path of degree-two verticesin Tprimeprime with the weight of this edge equal to the maximum weight of anedge in the path Specifically eachdeletion of a degree one vertex removes an edge that is not inTprimeprime and each contraction of a degree twovertex reduces the length of one of the paths inTprimeprime without changing the maximum weight of an edge on thepath This proves the assertion thatTprime is independent of the contraction order it hasO(|X|) edges becauseit has at most|X| leaves and no internal degree-two vertices ⊓⊔

Lemma 4 Trees Tprime and Cprime can be updated after any change to T or Clowast in timeO(logn) per change Eachchange to T C or X causesO(1) edges to change in Tprime and Cprime

Proof We use the following data structures forT First we use a dynamic tree data structure [15] that canfind the maximum weight edge on any path ofT and that can determine for any three query vertices ofT

8

which vertex forms the branching point between the paths connecting the three vertex Second we maintainan Euler tour data structure [11] that can find for a query vertex in T the one or two nearest vertices thatbelong toTprime Whenever a change toX adds a vertexv to the set of endpoints inX we must also addvto Tprime we do this by querying the Euler tour data structure to find the edge or vertex ofTprime at which thebranch tov should be added querying the dynamic tree data structure tofind the correct branching point onthat edge giving the overall graph structure of the new treeTprime and finally querying the dynamic tree datastructure again to find the weights of the changed edges inTprime To remove a vertex from the endpoints inXwe simply contract one or two edges as necessary inTprime To perform a swap inT we use the data structuresas described above to make all swap endpoints part ofTprime perform the swap and then contract edges toremove unnecessary vertices from the changedTprime The updates toCprime are similar ⊓⊔

Lemma 5 Let e be an edge of T that was not contracted in forming Tprime and let eprime be an edge of X Thene eprime is a swap in T if and only if it is a swap in Tprime

Lemma 6 Let eprime be an edge in X and let e be the heaviest edge forming a swape eprime in T Then e is notcontracted in forming Tprime

Theorem 2 Let M be a map with distinct edge weights changing according to the update operationsdescribed in the previous section as well as by changes to theweights of the edges Then in amortizedtimeO(logn + (logg)4) per update we can maintain a tree-cotree decomposition(T C X) where T is theminimum spanning tree C is the maximum spanning cotree andg is the genus of the map at the time of theupdate operation

Proof The overall algorithm is the same as the one in Theorem 1 but we use the data structures describedabove to maintain treesTprime andCprime and use the dynamic minimum spanning tree data structure ofHolm etal [12] to find the edgeeprime isin X forming the best swap for any edgeeisin T or elowast isin Clowast The time bound followsfrom plugging theO(|X|) bound on the number of edges inTprime cup X andCprime cup Xlowast into the time bound forthe minimum spanning tree data structure and using this bound to replace theO(g logn) time for findingreplacement edges in Theorem 1 ⊓⊔

The final improvement to our bounds comes from the observation that if we only wish to maintain atree-cotree decomposition for a graph without weights then we can replace the dynamic minimum spanningtree data structures forTprime cup X andCprime cup X with any dynamic connectivity data structure that maintains aspanning tree of these two dynamic graphs and changes the tree by a single swap per update to the graphsThe connectivity structure of Holm et al [12] as improved byThorup [18] is a suitable replacement

Theorem 3 Let M be a map with distinct edge weights changing according to the update operationsdescribed in the previous section as well as by changes to theweights of the edges Then in amortized timeO(logn + logg(log logg)3) per update we can maintain a tree-cotree decomposition(T C X) where g isthe genus of the map at the time of the update operation

44 Orientability

The results above are nearly sufficient to determine the surface underlying the dynamic mapM since itis known that 2-dimensional closed surfaces are classified by two quantities their genus (which we cancalculate from|X|) and theorientability of the surface We can compute the orientability from the followingsimple result which follows from the fact that the loops generated by edges inX form a cutset

9

Lemma 7 LetM have a tree-cotree decomposition(T C X) Then The surface on whichM is embeddedis unorientable if and only if every sufficiently small neighborhood of at least one of the loopsloop(T e) |eisin X is homeomorphic to a Mobius strip

Theorem 4 Let M be a map with distinct edge weights changing according to the update operationsdescribed in the previous section as well as by changes to theweights of the edges Then in amortized timeO(logn+ logg(log logg)3) per update we can determine after each update whether the surface underlyingthe map is orientable

Proof For any path inM we can form a sufficiently small neighborhood of the path by gluing togethera collection of disks where each disk has as its boundary thegem cycle representing a vertex or edge inthe path We choose an arbitrary clockwise orientation for the gem cycle representing each vertex inMand augment the Sleator-Tarjan dynamic tree data structureused to maintain the treeT in the tree-cotreedecomposition(T C X) by storing an extra bit per tree edge that is zero when the edgersquos preserves thechosen orientations of its two endpoints and one when it reverses these orientations we can use the dynamictree data structure to determine the parity of the sum of these bits along any path inT After each changeto the tree-cotree decomposition we use this data structure to determine whether anye isin X forms a loopwith odd total parity (including the parity ofe itself) If any odd loop is found the map is unorientable ifall loops are even the map is orientable ⊓⊔

5 Separator Theorems

Since Lipton and Tarjanrsquos discovery of the planar separatortheorem [14] separator theorems have becomewidely used in algorithms and there has been much work on improved constants for these theorems For-mally we define anǫ-separator of ann-vertex graphG to be a subsetSof the vertices ofG such that eachconnected component ofGShas at mostǫn vertices For graphs embedded on a genus-g orientable surfaceAleksandrov and Djidjev [1] showed that there always existsanǫ-separator with|S| le

radic

(16g + O(1ǫ))nWe combine our tree-cotree decomposition idea with the Lipton-Tarjan method of partitioning the breadthfirst search tree into levels (also used by Aleksandrov and Djidjev) to improve this result and extend it tounorientable surfaces

By Eulerrsquos formula if(T C X) is a tree-cotree decomposition of a map on an orientable surface then|X| = 2g whereg is the genus of the surface on whichM is embedded If the surface is unorientablethen |X| = g Because of this confusion between orientable and unorientable surfaces we prefer to usetheEuler characteristicχ(M) = |X| minus 2 in stating our results In terms ofχ Aleksandrov and Djidjevrsquosresult is that there exists a separator with|S| le

radic

(8χ + O(1ǫ))n We improve this by a factor ofradic

2 to|S| le

radic

(4χ + O(1ǫ))nLet T be a breadth first search tree of the given graph and form a tree-cotree decomposition(T C X)

For any pair of integers 0le i lt k define vertex setsLik andSik as followsLik consists of all verticesvwhose depthd(v) in T satisfiesd(v) equiv i (mod k) Sik is formed by adding toLik a pathPik(v) for eachendpointv of an edge inX wherePik(v) sub T connectsv to the first member ofLik on the path fromv tothe root ofT

Lemma 8 For any i and k G Sik is planar

Proof Extend the depth function on vertices to a continuous function λ M 7rarr R that maps each vertexto its depth maps each edge ofG one-to-one onto the interval between the depths of its endpoints andmaps each cell ofM in such a way that the map has no local minima or maxima in the interior of thecell Partition the surface underlying the mapM into submanifolds with boundary by removing all points

10

x for which λ(x) = i mod k Then each submanifold is formed fromM by cutting certain curves at depthλ(x) = i + ak (for some integera) and certain other curves at depthλ(x) = i + (a+ 1)k If we cap off thesecut curves with disks we form a manifoldMa without boundary Within each of the added disks at depthλ(x) = i + ak add a vertex connected by edges to all the vertices on the boundary of the disk the result isa graphGa embedded inMa such that each edge and vertex inGSik belongs to exactly one of the graphsGa If we let Ta be formed from the union ofT cap Ga with the newly added edges inGa thenTa is a forestdisjoint from the coforestC cap Ga so we can extend these two subgraphs to a tree-cotree decomposition(Tprime

a Cprimea Xprime

a) such thatXprimea sub XcapGa Therefore the pathsPik(v) for v an endpoint of an edge inXcapGa form

a cutset forMa andSik is a cutset for all ofM ⊓⊔

Lemma 9 For any k and any map embedded on a surface with Euler characteristic χsum

0leiltk

|Sik| le n + (χ + 2)k(kminus 1)

Proof Each vertex of the map belongs to exactly one graphLik In addition each of the 2(χ+ 2) endpointsv of edges inX contributes

sum |Pik(v)| =sum

0leiltk i vertices to the total Some vertices may be in more thanone pathPik(v) but this only reduces the total ⊓⊔

Theorem 5 Any n-vertex graph G embedded on a surface with Euler characteristic χ has anǫ-separatorwith |S| le

radic

(4χ + O(1ǫ))n vertices

Proof By choosingi minimizing |Sik| we achieve|Sik| le nk+χk+O(k) The result follows by choosingk =

radic

nχ applying a planar separator theorem to the planar graphG Sik and forming the union of theplanar separator withSik ⊓⊔

If a map representing a characteristic-χ embedding ofG is given as input the method described in theproof of the theorem can be implemented to run in time linear in the size of the map and produces a cutsetof size at most

radic

(4χ + O(1))n The time bound for the overall algorithm and the constant factor in theradic

O(nǫ) term in the separator size depend on the choice of planar separator algorithm used to completethe separator construction

We note that not all loops need always be incorporated inSik in order to makeG Sik planar Forinstance ifG is embedded on a torus it can be cut into a planar graph in the form of a cylinder by removingonly one of the two loops In addition if we chooseSik in such a way that some of the subgraphsTa andC cap Ga described in the proof of Lemma 8 are disconnected then additional edges are removed fromX informing the tree-cotree decompositions ofMa and again we can reduce the number of loops Can we usethese observations to further reduce the constant factor inour separator theorem

6 Low-Diameter Tree Decomposition

In previous work [5] we showed that in a minor-closed graph family the treewidth of a graph with diameterD can be bounded by a function ofD if and only if the family excludes some apex graph For instance forplanar graphs (which exclude the apex graphK5) the treewidth is at most 3D minus O(1) [2] Suchboundedlocal treewidthresults can be used to find efficient solutions to many important algorithmic problems onthese graphs [2459]

In particular any graph embedded on a genusg = O(1) surface has bounded local treewidth since thefamily of such graphs is minor-closed and excludes an apex graph However the treewidth bound from thisgeneral result grows rapidly withg and in this special case we were able to prove a tighter bound

11

Theorem 6 (Eppstein [5])Let G have genus g and diameter D Then G has treewidthO(gD)

The proof relies on showing the existence of a cutset of sizeO(gD) and forming a tree-decompositionby adding this cutset to each node in a tree-decomposition ofthe remaining planar graph However one stepin the proof is to find the minimum cardinality cutset so the proof is nonconstructive and Erickson andSar-Peled [8] later showed that in fact finding minimum cutsets is NP-complete By replacing this step withmethods based on our tree-cotree decomposition we can turnthis nonconstructive proof into an efficientalgorithm

Theorem 7 Let G have genus g and diameter D and suppose that we are givenas input an embeddingMof G on a surface of genus g Then in timeO(gDn) we can find a tree-decomposition of G with treewidthO(gD)

Proof We form a tree-decomposition(T C X) by lettingT be a breadth-first spanning tree ofG and lettingC be any spanning cotree disjoint fromT We then letSbe the set of vertices incident to the edges in loopsloop(T e) | eisin X Each loop has at most 2D edges so|S| = O(gD) andG S is planar so it has a tree-decomposition of treewidth 3DminusO(1) that can be found in timeO(Dn) [2] We form a tree-decompositionof G by addingS to each node in the tree-decomposition ofG S ⊓⊔

TheO(gDn) time bound is optimal in the sense that it is the size of an explicit representation of theresulting tree-decomposition but if we represent the setsof vertices at each tree-decomposition node im-plicitly as a union of a constant number of paths in the two treesT andB the time can be reduced to linearin the size of the input mapM

7 Conclusions

We have shown how the tree-cotree decomposition can be used in several applications for graphs embeddedon surfaces maintaining dynamic properties of the graph computing separators and constructing tree-decompositions of small treewidth There are many other important planar graph algorithms that can begeneralized to graphs embedded on surfaces and it would be interesting to see which others of these can beimproved by the use of our tree-cotree decomposition methods

Acknowledgements

This research was supported in part by NSF grant CCR-9912338

References

1 L Aleksandrov and H Djidjev Linear algorithms for partitioning embedded graphs of bounded genusSIAM J DiscreteMath9129ndash150 1996 httpwwwdcswarwickacuksimhristopapersgenus-separatorpsZ

2 B S Baker Approximation algorithms for NP-complete problems on planar graphsJ Assoc Comput Mach41153ndash1801994

3 C P Bonnington and C H C LittleThe Foundations of Topological Graph Theory Springer-Verlag 19954 D Eppstein Subgraph isomorphism in planar graphs and related problemsJ Graph Algorithms amp Applications3(3)1ndash27

1999 arXivcsDS99110035 D Eppstein Diameter and treewidth in minor-closed graph familiesAlgorithmica27275ndash291 2000

httplinkspringer-nycomlinkservicejournals00453contents0010020 arXivmathCO99071266 D Eppstein Z Galil G F Italiano and T H Spencer Separator based sparsification I planarity testing and minimum

spanning treesJ Computing amp Systems Sciences52(1)3ndash27 February 19967 D Eppstein G F Italiano R Tamassia R E Tarjan J R Westbrook and M Yung Maintenance of a minimum spanning

forest in a dynamic planar graphJ Algorithms13(1)33ndash54 March 1992

12

8 J Erickson and S Har-Peled Optimally cutting a surfaceinto a diskProc 18th ACM Symp Computational Geometrypp 244ndash253 June 2002 httpcompgeomcsuiucedusimjeffepubsschemahtml arXivcsCG0207004

9 M Grohe Local tree-width excluded minors and approximation algorithms arXivorg e-Print archive January 2000arXivmathCO0001128

10 J L Gross and T W TuckerTopological Graph Theory Dover Publications 200111 M R Henzinger and V King Randomized fully dynamic graph algorithms with polylogarithmic time per operationJ ACM

46(4)502ndash536 July 199912 J Holm K de Lichtenberg and M Thorup Poly-logarithmic deterministic fully-dynamic graph algorithms for connectivity

minimum spanning tree 2-edge and biconnectivityJ ACM48(4)723ndash760 July 200113 S Lins Graph-encoded mapsJ Combinatorial Theory Ser B32171ndash181 198214 R Lipton and R E Tarjan A separator theorem for planargraphsSIAM J Applied Math36(2)177ndash189 April 197915 D D Sleator and R E Tarjan A data structure for dynamic treesJ Computing amp Systems Sciences26362ndash391 198316 D A Spielman and S-H Teng Disk packings and planar separatorsProc 12th ACM Symp Computational Geometry

pp 349ndash358 1996 httpwww-mathmitedusimspielmanResearchseparatorhtml17 J StillwellClassical Topology and Combinatorial Group Theory Graduate Texts in Mathematics 72 Springer-Verlag 2nd

edition 199318 M Thorup Near-optimal fully-dynamic graph connectivity Proc 32nd ACM Symp Theory of Computing pp 343ndash350 May

200019 G Vegter and C-K Yap Computational complexity of combinatorial surfacesProc 6th ACM Symp Computational

Geometry pp 102ndash111 1990 httpwwwacmorgpubscitationsproceedingscompgeom98524p102-vegter

13

Page 7: Dynamic Generators of Topologically Embedded Graphs

we allow the dual operations to insertions and deletions asshown on the upper right of the figure dualdeletion is more familiar as the operation of edge contraction The dual of a cell-merging insertion mergestwo vertices of the graph while increasing the genus the dual of a cell-splitting insertion splits a vertexinto two adjacent vertices and the dual of a cell-twisting insertion changes the order of the edges and cellsaround a vertex We do not describe these in detail because our data structure will be self-dual so that eachdual operation is performed exactly as the primal operationsubstitutingSV for SC and vice versa

Finally it is possible to specify an insertion in whichSE(p) andSE(q) are not distinct Ifp 6= q whileSE(p) = SE(q) (Fig 2 lower left) we subdivideSE into a path of five edges and connect the four new gemvertices into anSV-SC cycle in such a way that adjacent vertices of the cycle are connected top andq Thiscan be viewed as a special case of a cell-splitting insertionin which the two endpoints of the inserted edgeare placed next to each other at the same vertex creating a one-sided cell contained within the previouslyexisting cell The dual of this operation adds a new degree-one vertex to the graph

If p = q we perform an edge insertion by again subdividingSE into a path of five edges and connectingthe four new gem vertices into anSV-SC cycle in such a way that opposite vertices of the cycle are connectedto p and the other endpoint ofSE(p) Edge insertion withp = q and dual edge insertion withp = q producethe same result shown in the lower right of Fig 2 This can beviewed as a special case of a cell-twistinginsertion in which the two endpoints of the inserted edge areplaced next to each other at the same vertex

42 Simple Dynamic Generators

We now describe a simple scheme for maintaining generators and minimum spanning trees in dynamic mapsbased on the dynamic planar graph algorithms of Eppstein et al [7] We will later show how to improve thetime bounds for this scheme at the expense of some additionalcomplexity

Theorem 1 Let M be a map with distinct edge weights changing according to the update operationsdescribed in the previous section as well as by changes to theweights of the edges Then in timeO(g logn)per update we can maintain a tree-cotree decomposition(T C X) where T is the minimum spanning treeC is the maximum spanning cotree and g is the genus of the map at the time of the update operation

Proof We representT by Sleator and Tarjanrsquos dynamic tree data structure [15] modified as in [7] to supportedge contraction and expansion operations as well as the more usual edge insertions and deletions We use asimilar data structure to represent the dual treeClowast With this data structure we can find in logarithmic timethe longest edge on any path ofT or the shortest edge on any path ofClowast We can also test in logarithmic timewhether a pair of edgese eprime forms aswap that is whetherTe eprime (where denotes the set-theoreticsymmetric difference) is another spanning tree ofT We also maintain the tree data structures discussed inSection 2 for the adjacency lists of each vertex and face ofM which allow us to classify the type of aninsertion or deletion in logarithmic time

To increase the weight of an edgee in T cup X we first test whether the increased weight causes the edgeto move to the maximum cotreeC by finding the shortest edgeeprime on the dual path connecting the endpointsof elowast and testing whether the dual swape eprime increases the weight ofC If so we adde to C and moveeprime

to X We then searchX for the minimum weight edgeeprimeprime forming a swape eprimeprime in T and testing whetherthis swap causes an improvement in the weight ofT If it does we addeprimeprime to T and movee to X Lemma 1shows that after these steps we must again have a tree-cotree partition To decrease the weight of an edgeein Ccup X we perform a similar sequence of steps on the dual tree-cotree-partition(Clowast Tlowast Xlowast)

We now describe the effect on our data structure of the various insertion and deletion operations Theedge expansions and contractions are performed by very similar sequences of steps in the dual map

ndash To perform a cell-merging insertion of an edgee we find the lightest edgeeprime on the dual path inClowast

connecting the merged cells and place botheandeprime in X We then perform swaps similar to those for a

7

weight change to determine whethere should move intoT or C To perform a cell-splitting deletion ofe we searchX for the heaviest edgeeprime connecting the two components ofClowast formed by the split andmoveeprime into C

ndash To perform a cell-splitting insertion of an edgee we adde to X searchX for the heaviest edgeeprime

connecting the two components ofClowast formed by the split and perform swaps similar to those for aweight change to determine whether to movee into T or C To perform a cell-merging deletion ofewe increase the weight ofe until it belongs toC then remove it from the graph and merge its two dualendpoints

ndash To perform a cell-twisting insertion of an edgee we simply adde to X search for the best swape eprimewith eprime isin T and perform this swap if it improves the weight ofT The inserted edgeecan not belong toC sinceelowast connects a dual vertex to itself To perform an untwisting deletion we test whetherebelongsto T and if so swap it with the best replacementeprime isin X before removing it

Each of these operations maintains the desired partition via a sequence ofO(g) dynamic tree queriesand updates so the total time per change toM isO(g logn) ⊓⊔

If we wish to maintain a tree-cotree decomposition of a graphwithout weights we can choose weightsfor the edges arbitrarily

43 Improved Dynamic Generators

The bottleneck of Theorem 1 is the search for swaps in graphsT cup X or Clowast cup Xlowast performing this search bytesting each edge inXlowast takes timeO(g logn) We can improve this by using the method of separator basedsparsification [6] to replaceT andClowast by contracted treesTprime andCprime that match theO(g) size ofX and thenapplying a general dynamic graph connectivity algorithm [12 18] to find the swaps in the smaller graphsTprime cup X or Cprime cup Xlowast

Specifically we formTprime from T by repeated edge contractions forming a sequence of treesT0 =T T1 Tk = Tprime If Ti contains a vertex with degree one that is not an endpoint of anedge inX wedelete that vertex and its adjacent edge to formTi+1 Otherwise ifTi contains a vertex with degree two thatis not an endpoint of an edge inX let e andeprime be the two edges incident to that vertex we formTi+1 bycontracting whichever ofe andeprime has the smaller weight The construction ofCprime from Clowast is essentially thesame except that we contract the larger weight of two edges incident to any degree two vertex

Lemma 3 The trees Tprime and Cprime described above haveO(|X|) edges and do not depend on the order inwhich the contractions are performed

Proof Consider the set of paths inT connecting endpoints ofX The union of these paths forms a subtreeTprimeprime

of T Then an alternative description ofTprime is that it consists of one edge for each path of degree-two verticesin Tprimeprime with the weight of this edge equal to the maximum weight of anedge in the path Specifically eachdeletion of a degree one vertex removes an edge that is not inTprimeprime and each contraction of a degree twovertex reduces the length of one of the paths inTprimeprime without changing the maximum weight of an edge on thepath This proves the assertion thatTprime is independent of the contraction order it hasO(|X|) edges becauseit has at most|X| leaves and no internal degree-two vertices ⊓⊔

Lemma 4 Trees Tprime and Cprime can be updated after any change to T or Clowast in timeO(logn) per change Eachchange to T C or X causesO(1) edges to change in Tprime and Cprime

Proof We use the following data structures forT First we use a dynamic tree data structure [15] that canfind the maximum weight edge on any path ofT and that can determine for any three query vertices ofT

8

which vertex forms the branching point between the paths connecting the three vertex Second we maintainan Euler tour data structure [11] that can find for a query vertex in T the one or two nearest vertices thatbelong toTprime Whenever a change toX adds a vertexv to the set of endpoints inX we must also addvto Tprime we do this by querying the Euler tour data structure to find the edge or vertex ofTprime at which thebranch tov should be added querying the dynamic tree data structure tofind the correct branching point onthat edge giving the overall graph structure of the new treeTprime and finally querying the dynamic tree datastructure again to find the weights of the changed edges inTprime To remove a vertex from the endpoints inXwe simply contract one or two edges as necessary inTprime To perform a swap inT we use the data structuresas described above to make all swap endpoints part ofTprime perform the swap and then contract edges toremove unnecessary vertices from the changedTprime The updates toCprime are similar ⊓⊔

Lemma 5 Let e be an edge of T that was not contracted in forming Tprime and let eprime be an edge of X Thene eprime is a swap in T if and only if it is a swap in Tprime

Lemma 6 Let eprime be an edge in X and let e be the heaviest edge forming a swape eprime in T Then e is notcontracted in forming Tprime

Theorem 2 Let M be a map with distinct edge weights changing according to the update operationsdescribed in the previous section as well as by changes to theweights of the edges Then in amortizedtimeO(logn + (logg)4) per update we can maintain a tree-cotree decomposition(T C X) where T is theminimum spanning tree C is the maximum spanning cotree andg is the genus of the map at the time of theupdate operation

Proof The overall algorithm is the same as the one in Theorem 1 but we use the data structures describedabove to maintain treesTprime andCprime and use the dynamic minimum spanning tree data structure ofHolm etal [12] to find the edgeeprime isin X forming the best swap for any edgeeisin T or elowast isin Clowast The time bound followsfrom plugging theO(|X|) bound on the number of edges inTprime cup X andCprime cup Xlowast into the time bound forthe minimum spanning tree data structure and using this bound to replace theO(g logn) time for findingreplacement edges in Theorem 1 ⊓⊔

The final improvement to our bounds comes from the observation that if we only wish to maintain atree-cotree decomposition for a graph without weights then we can replace the dynamic minimum spanningtree data structures forTprime cup X andCprime cup X with any dynamic connectivity data structure that maintains aspanning tree of these two dynamic graphs and changes the tree by a single swap per update to the graphsThe connectivity structure of Holm et al [12] as improved byThorup [18] is a suitable replacement

Theorem 3 Let M be a map with distinct edge weights changing according to the update operationsdescribed in the previous section as well as by changes to theweights of the edges Then in amortized timeO(logn + logg(log logg)3) per update we can maintain a tree-cotree decomposition(T C X) where g isthe genus of the map at the time of the update operation

44 Orientability

The results above are nearly sufficient to determine the surface underlying the dynamic mapM since itis known that 2-dimensional closed surfaces are classified by two quantities their genus (which we cancalculate from|X|) and theorientability of the surface We can compute the orientability from the followingsimple result which follows from the fact that the loops generated by edges inX form a cutset

9

Lemma 7 LetM have a tree-cotree decomposition(T C X) Then The surface on whichM is embeddedis unorientable if and only if every sufficiently small neighborhood of at least one of the loopsloop(T e) |eisin X is homeomorphic to a Mobius strip

Theorem 4 Let M be a map with distinct edge weights changing according to the update operationsdescribed in the previous section as well as by changes to theweights of the edges Then in amortized timeO(logn+ logg(log logg)3) per update we can determine after each update whether the surface underlyingthe map is orientable

Proof For any path inM we can form a sufficiently small neighborhood of the path by gluing togethera collection of disks where each disk has as its boundary thegem cycle representing a vertex or edge inthe path We choose an arbitrary clockwise orientation for the gem cycle representing each vertex inMand augment the Sleator-Tarjan dynamic tree data structureused to maintain the treeT in the tree-cotreedecomposition(T C X) by storing an extra bit per tree edge that is zero when the edgersquos preserves thechosen orientations of its two endpoints and one when it reverses these orientations we can use the dynamictree data structure to determine the parity of the sum of these bits along any path inT After each changeto the tree-cotree decomposition we use this data structure to determine whether anye isin X forms a loopwith odd total parity (including the parity ofe itself) If any odd loop is found the map is unorientable ifall loops are even the map is orientable ⊓⊔

5 Separator Theorems

Since Lipton and Tarjanrsquos discovery of the planar separatortheorem [14] separator theorems have becomewidely used in algorithms and there has been much work on improved constants for these theorems For-mally we define anǫ-separator of ann-vertex graphG to be a subsetSof the vertices ofG such that eachconnected component ofGShas at mostǫn vertices For graphs embedded on a genus-g orientable surfaceAleksandrov and Djidjev [1] showed that there always existsanǫ-separator with|S| le

radic

(16g + O(1ǫ))nWe combine our tree-cotree decomposition idea with the Lipton-Tarjan method of partitioning the breadthfirst search tree into levels (also used by Aleksandrov and Djidjev) to improve this result and extend it tounorientable surfaces

By Eulerrsquos formula if(T C X) is a tree-cotree decomposition of a map on an orientable surface then|X| = 2g whereg is the genus of the surface on whichM is embedded If the surface is unorientablethen |X| = g Because of this confusion between orientable and unorientable surfaces we prefer to usetheEuler characteristicχ(M) = |X| minus 2 in stating our results In terms ofχ Aleksandrov and Djidjevrsquosresult is that there exists a separator with|S| le

radic

(8χ + O(1ǫ))n We improve this by a factor ofradic

2 to|S| le

radic

(4χ + O(1ǫ))nLet T be a breadth first search tree of the given graph and form a tree-cotree decomposition(T C X)

For any pair of integers 0le i lt k define vertex setsLik andSik as followsLik consists of all verticesvwhose depthd(v) in T satisfiesd(v) equiv i (mod k) Sik is formed by adding toLik a pathPik(v) for eachendpointv of an edge inX wherePik(v) sub T connectsv to the first member ofLik on the path fromv tothe root ofT

Lemma 8 For any i and k G Sik is planar

Proof Extend the depth function on vertices to a continuous function λ M 7rarr R that maps each vertexto its depth maps each edge ofG one-to-one onto the interval between the depths of its endpoints andmaps each cell ofM in such a way that the map has no local minima or maxima in the interior of thecell Partition the surface underlying the mapM into submanifolds with boundary by removing all points

10

x for which λ(x) = i mod k Then each submanifold is formed fromM by cutting certain curves at depthλ(x) = i + ak (for some integera) and certain other curves at depthλ(x) = i + (a+ 1)k If we cap off thesecut curves with disks we form a manifoldMa without boundary Within each of the added disks at depthλ(x) = i + ak add a vertex connected by edges to all the vertices on the boundary of the disk the result isa graphGa embedded inMa such that each edge and vertex inGSik belongs to exactly one of the graphsGa If we let Ta be formed from the union ofT cap Ga with the newly added edges inGa thenTa is a forestdisjoint from the coforestC cap Ga so we can extend these two subgraphs to a tree-cotree decomposition(Tprime

a Cprimea Xprime

a) such thatXprimea sub XcapGa Therefore the pathsPik(v) for v an endpoint of an edge inXcapGa form

a cutset forMa andSik is a cutset for all ofM ⊓⊔

Lemma 9 For any k and any map embedded on a surface with Euler characteristic χsum

0leiltk

|Sik| le n + (χ + 2)k(kminus 1)

Proof Each vertex of the map belongs to exactly one graphLik In addition each of the 2(χ+ 2) endpointsv of edges inX contributes

sum |Pik(v)| =sum

0leiltk i vertices to the total Some vertices may be in more thanone pathPik(v) but this only reduces the total ⊓⊔

Theorem 5 Any n-vertex graph G embedded on a surface with Euler characteristic χ has anǫ-separatorwith |S| le

radic

(4χ + O(1ǫ))n vertices

Proof By choosingi minimizing |Sik| we achieve|Sik| le nk+χk+O(k) The result follows by choosingk =

radic

nχ applying a planar separator theorem to the planar graphG Sik and forming the union of theplanar separator withSik ⊓⊔

If a map representing a characteristic-χ embedding ofG is given as input the method described in theproof of the theorem can be implemented to run in time linear in the size of the map and produces a cutsetof size at most

radic

(4χ + O(1))n The time bound for the overall algorithm and the constant factor in theradic

O(nǫ) term in the separator size depend on the choice of planar separator algorithm used to completethe separator construction

We note that not all loops need always be incorporated inSik in order to makeG Sik planar Forinstance ifG is embedded on a torus it can be cut into a planar graph in the form of a cylinder by removingonly one of the two loops In addition if we chooseSik in such a way that some of the subgraphsTa andC cap Ga described in the proof of Lemma 8 are disconnected then additional edges are removed fromX informing the tree-cotree decompositions ofMa and again we can reduce the number of loops Can we usethese observations to further reduce the constant factor inour separator theorem

6 Low-Diameter Tree Decomposition

In previous work [5] we showed that in a minor-closed graph family the treewidth of a graph with diameterD can be bounded by a function ofD if and only if the family excludes some apex graph For instance forplanar graphs (which exclude the apex graphK5) the treewidth is at most 3D minus O(1) [2] Suchboundedlocal treewidthresults can be used to find efficient solutions to many important algorithmic problems onthese graphs [2459]

In particular any graph embedded on a genusg = O(1) surface has bounded local treewidth since thefamily of such graphs is minor-closed and excludes an apex graph However the treewidth bound from thisgeneral result grows rapidly withg and in this special case we were able to prove a tighter bound

11

Theorem 6 (Eppstein [5])Let G have genus g and diameter D Then G has treewidthO(gD)

The proof relies on showing the existence of a cutset of sizeO(gD) and forming a tree-decompositionby adding this cutset to each node in a tree-decomposition ofthe remaining planar graph However one stepin the proof is to find the minimum cardinality cutset so the proof is nonconstructive and Erickson andSar-Peled [8] later showed that in fact finding minimum cutsets is NP-complete By replacing this step withmethods based on our tree-cotree decomposition we can turnthis nonconstructive proof into an efficientalgorithm

Theorem 7 Let G have genus g and diameter D and suppose that we are givenas input an embeddingMof G on a surface of genus g Then in timeO(gDn) we can find a tree-decomposition of G with treewidthO(gD)

Proof We form a tree-decomposition(T C X) by lettingT be a breadth-first spanning tree ofG and lettingC be any spanning cotree disjoint fromT We then letSbe the set of vertices incident to the edges in loopsloop(T e) | eisin X Each loop has at most 2D edges so|S| = O(gD) andG S is planar so it has a tree-decomposition of treewidth 3DminusO(1) that can be found in timeO(Dn) [2] We form a tree-decompositionof G by addingS to each node in the tree-decomposition ofG S ⊓⊔

TheO(gDn) time bound is optimal in the sense that it is the size of an explicit representation of theresulting tree-decomposition but if we represent the setsof vertices at each tree-decomposition node im-plicitly as a union of a constant number of paths in the two treesT andB the time can be reduced to linearin the size of the input mapM

7 Conclusions

We have shown how the tree-cotree decomposition can be used in several applications for graphs embeddedon surfaces maintaining dynamic properties of the graph computing separators and constructing tree-decompositions of small treewidth There are many other important planar graph algorithms that can begeneralized to graphs embedded on surfaces and it would be interesting to see which others of these can beimproved by the use of our tree-cotree decomposition methods

Acknowledgements

This research was supported in part by NSF grant CCR-9912338

References

1 L Aleksandrov and H Djidjev Linear algorithms for partitioning embedded graphs of bounded genusSIAM J DiscreteMath9129ndash150 1996 httpwwwdcswarwickacuksimhristopapersgenus-separatorpsZ

2 B S Baker Approximation algorithms for NP-complete problems on planar graphsJ Assoc Comput Mach41153ndash1801994

3 C P Bonnington and C H C LittleThe Foundations of Topological Graph Theory Springer-Verlag 19954 D Eppstein Subgraph isomorphism in planar graphs and related problemsJ Graph Algorithms amp Applications3(3)1ndash27

1999 arXivcsDS99110035 D Eppstein Diameter and treewidth in minor-closed graph familiesAlgorithmica27275ndash291 2000

httplinkspringer-nycomlinkservicejournals00453contents0010020 arXivmathCO99071266 D Eppstein Z Galil G F Italiano and T H Spencer Separator based sparsification I planarity testing and minimum

spanning treesJ Computing amp Systems Sciences52(1)3ndash27 February 19967 D Eppstein G F Italiano R Tamassia R E Tarjan J R Westbrook and M Yung Maintenance of a minimum spanning

forest in a dynamic planar graphJ Algorithms13(1)33ndash54 March 1992

12

8 J Erickson and S Har-Peled Optimally cutting a surfaceinto a diskProc 18th ACM Symp Computational Geometrypp 244ndash253 June 2002 httpcompgeomcsuiucedusimjeffepubsschemahtml arXivcsCG0207004

9 M Grohe Local tree-width excluded minors and approximation algorithms arXivorg e-Print archive January 2000arXivmathCO0001128

10 J L Gross and T W TuckerTopological Graph Theory Dover Publications 200111 M R Henzinger and V King Randomized fully dynamic graph algorithms with polylogarithmic time per operationJ ACM

46(4)502ndash536 July 199912 J Holm K de Lichtenberg and M Thorup Poly-logarithmic deterministic fully-dynamic graph algorithms for connectivity

minimum spanning tree 2-edge and biconnectivityJ ACM48(4)723ndash760 July 200113 S Lins Graph-encoded mapsJ Combinatorial Theory Ser B32171ndash181 198214 R Lipton and R E Tarjan A separator theorem for planargraphsSIAM J Applied Math36(2)177ndash189 April 197915 D D Sleator and R E Tarjan A data structure for dynamic treesJ Computing amp Systems Sciences26362ndash391 198316 D A Spielman and S-H Teng Disk packings and planar separatorsProc 12th ACM Symp Computational Geometry

pp 349ndash358 1996 httpwww-mathmitedusimspielmanResearchseparatorhtml17 J StillwellClassical Topology and Combinatorial Group Theory Graduate Texts in Mathematics 72 Springer-Verlag 2nd

edition 199318 M Thorup Near-optimal fully-dynamic graph connectivity Proc 32nd ACM Symp Theory of Computing pp 343ndash350 May

200019 G Vegter and C-K Yap Computational complexity of combinatorial surfacesProc 6th ACM Symp Computational

Geometry pp 102ndash111 1990 httpwwwacmorgpubscitationsproceedingscompgeom98524p102-vegter

13

Page 8: Dynamic Generators of Topologically Embedded Graphs

weight change to determine whethere should move intoT or C To perform a cell-splitting deletion ofe we searchX for the heaviest edgeeprime connecting the two components ofClowast formed by the split andmoveeprime into C

ndash To perform a cell-splitting insertion of an edgee we adde to X searchX for the heaviest edgeeprime

connecting the two components ofClowast formed by the split and perform swaps similar to those for aweight change to determine whether to movee into T or C To perform a cell-merging deletion ofewe increase the weight ofe until it belongs toC then remove it from the graph and merge its two dualendpoints

ndash To perform a cell-twisting insertion of an edgee we simply adde to X search for the best swape eprimewith eprime isin T and perform this swap if it improves the weight ofT The inserted edgeecan not belong toC sinceelowast connects a dual vertex to itself To perform an untwisting deletion we test whetherebelongsto T and if so swap it with the best replacementeprime isin X before removing it

Each of these operations maintains the desired partition via a sequence ofO(g) dynamic tree queriesand updates so the total time per change toM isO(g logn) ⊓⊔

If we wish to maintain a tree-cotree decomposition of a graphwithout weights we can choose weightsfor the edges arbitrarily

43 Improved Dynamic Generators

The bottleneck of Theorem 1 is the search for swaps in graphsT cup X or Clowast cup Xlowast performing this search bytesting each edge inXlowast takes timeO(g logn) We can improve this by using the method of separator basedsparsification [6] to replaceT andClowast by contracted treesTprime andCprime that match theO(g) size ofX and thenapplying a general dynamic graph connectivity algorithm [12 18] to find the swaps in the smaller graphsTprime cup X or Cprime cup Xlowast

Specifically we formTprime from T by repeated edge contractions forming a sequence of treesT0 =T T1 Tk = Tprime If Ti contains a vertex with degree one that is not an endpoint of anedge inX wedelete that vertex and its adjacent edge to formTi+1 Otherwise ifTi contains a vertex with degree two thatis not an endpoint of an edge inX let e andeprime be the two edges incident to that vertex we formTi+1 bycontracting whichever ofe andeprime has the smaller weight The construction ofCprime from Clowast is essentially thesame except that we contract the larger weight of two edges incident to any degree two vertex

Lemma 3 The trees Tprime and Cprime described above haveO(|X|) edges and do not depend on the order inwhich the contractions are performed

Proof Consider the set of paths inT connecting endpoints ofX The union of these paths forms a subtreeTprimeprime

of T Then an alternative description ofTprime is that it consists of one edge for each path of degree-two verticesin Tprimeprime with the weight of this edge equal to the maximum weight of anedge in the path Specifically eachdeletion of a degree one vertex removes an edge that is not inTprimeprime and each contraction of a degree twovertex reduces the length of one of the paths inTprimeprime without changing the maximum weight of an edge on thepath This proves the assertion thatTprime is independent of the contraction order it hasO(|X|) edges becauseit has at most|X| leaves and no internal degree-two vertices ⊓⊔

Lemma 4 Trees Tprime and Cprime can be updated after any change to T or Clowast in timeO(logn) per change Eachchange to T C or X causesO(1) edges to change in Tprime and Cprime

Proof We use the following data structures forT First we use a dynamic tree data structure [15] that canfind the maximum weight edge on any path ofT and that can determine for any three query vertices ofT

8

which vertex forms the branching point between the paths connecting the three vertex Second we maintainan Euler tour data structure [11] that can find for a query vertex in T the one or two nearest vertices thatbelong toTprime Whenever a change toX adds a vertexv to the set of endpoints inX we must also addvto Tprime we do this by querying the Euler tour data structure to find the edge or vertex ofTprime at which thebranch tov should be added querying the dynamic tree data structure tofind the correct branching point onthat edge giving the overall graph structure of the new treeTprime and finally querying the dynamic tree datastructure again to find the weights of the changed edges inTprime To remove a vertex from the endpoints inXwe simply contract one or two edges as necessary inTprime To perform a swap inT we use the data structuresas described above to make all swap endpoints part ofTprime perform the swap and then contract edges toremove unnecessary vertices from the changedTprime The updates toCprime are similar ⊓⊔

Lemma 5 Let e be an edge of T that was not contracted in forming Tprime and let eprime be an edge of X Thene eprime is a swap in T if and only if it is a swap in Tprime

Lemma 6 Let eprime be an edge in X and let e be the heaviest edge forming a swape eprime in T Then e is notcontracted in forming Tprime

Theorem 2 Let M be a map with distinct edge weights changing according to the update operationsdescribed in the previous section as well as by changes to theweights of the edges Then in amortizedtimeO(logn + (logg)4) per update we can maintain a tree-cotree decomposition(T C X) where T is theminimum spanning tree C is the maximum spanning cotree andg is the genus of the map at the time of theupdate operation

Proof The overall algorithm is the same as the one in Theorem 1 but we use the data structures describedabove to maintain treesTprime andCprime and use the dynamic minimum spanning tree data structure ofHolm etal [12] to find the edgeeprime isin X forming the best swap for any edgeeisin T or elowast isin Clowast The time bound followsfrom plugging theO(|X|) bound on the number of edges inTprime cup X andCprime cup Xlowast into the time bound forthe minimum spanning tree data structure and using this bound to replace theO(g logn) time for findingreplacement edges in Theorem 1 ⊓⊔

The final improvement to our bounds comes from the observation that if we only wish to maintain atree-cotree decomposition for a graph without weights then we can replace the dynamic minimum spanningtree data structures forTprime cup X andCprime cup X with any dynamic connectivity data structure that maintains aspanning tree of these two dynamic graphs and changes the tree by a single swap per update to the graphsThe connectivity structure of Holm et al [12] as improved byThorup [18] is a suitable replacement

Theorem 3 Let M be a map with distinct edge weights changing according to the update operationsdescribed in the previous section as well as by changes to theweights of the edges Then in amortized timeO(logn + logg(log logg)3) per update we can maintain a tree-cotree decomposition(T C X) where g isthe genus of the map at the time of the update operation

44 Orientability

The results above are nearly sufficient to determine the surface underlying the dynamic mapM since itis known that 2-dimensional closed surfaces are classified by two quantities their genus (which we cancalculate from|X|) and theorientability of the surface We can compute the orientability from the followingsimple result which follows from the fact that the loops generated by edges inX form a cutset

9

Lemma 7 LetM have a tree-cotree decomposition(T C X) Then The surface on whichM is embeddedis unorientable if and only if every sufficiently small neighborhood of at least one of the loopsloop(T e) |eisin X is homeomorphic to a Mobius strip

Theorem 4 Let M be a map with distinct edge weights changing according to the update operationsdescribed in the previous section as well as by changes to theweights of the edges Then in amortized timeO(logn+ logg(log logg)3) per update we can determine after each update whether the surface underlyingthe map is orientable

Proof For any path inM we can form a sufficiently small neighborhood of the path by gluing togethera collection of disks where each disk has as its boundary thegem cycle representing a vertex or edge inthe path We choose an arbitrary clockwise orientation for the gem cycle representing each vertex inMand augment the Sleator-Tarjan dynamic tree data structureused to maintain the treeT in the tree-cotreedecomposition(T C X) by storing an extra bit per tree edge that is zero when the edgersquos preserves thechosen orientations of its two endpoints and one when it reverses these orientations we can use the dynamictree data structure to determine the parity of the sum of these bits along any path inT After each changeto the tree-cotree decomposition we use this data structure to determine whether anye isin X forms a loopwith odd total parity (including the parity ofe itself) If any odd loop is found the map is unorientable ifall loops are even the map is orientable ⊓⊔

5 Separator Theorems

Since Lipton and Tarjanrsquos discovery of the planar separatortheorem [14] separator theorems have becomewidely used in algorithms and there has been much work on improved constants for these theorems For-mally we define anǫ-separator of ann-vertex graphG to be a subsetSof the vertices ofG such that eachconnected component ofGShas at mostǫn vertices For graphs embedded on a genus-g orientable surfaceAleksandrov and Djidjev [1] showed that there always existsanǫ-separator with|S| le

radic

(16g + O(1ǫ))nWe combine our tree-cotree decomposition idea with the Lipton-Tarjan method of partitioning the breadthfirst search tree into levels (also used by Aleksandrov and Djidjev) to improve this result and extend it tounorientable surfaces

By Eulerrsquos formula if(T C X) is a tree-cotree decomposition of a map on an orientable surface then|X| = 2g whereg is the genus of the surface on whichM is embedded If the surface is unorientablethen |X| = g Because of this confusion between orientable and unorientable surfaces we prefer to usetheEuler characteristicχ(M) = |X| minus 2 in stating our results In terms ofχ Aleksandrov and Djidjevrsquosresult is that there exists a separator with|S| le

radic

(8χ + O(1ǫ))n We improve this by a factor ofradic

2 to|S| le

radic

(4χ + O(1ǫ))nLet T be a breadth first search tree of the given graph and form a tree-cotree decomposition(T C X)

For any pair of integers 0le i lt k define vertex setsLik andSik as followsLik consists of all verticesvwhose depthd(v) in T satisfiesd(v) equiv i (mod k) Sik is formed by adding toLik a pathPik(v) for eachendpointv of an edge inX wherePik(v) sub T connectsv to the first member ofLik on the path fromv tothe root ofT

Lemma 8 For any i and k G Sik is planar

Proof Extend the depth function on vertices to a continuous function λ M 7rarr R that maps each vertexto its depth maps each edge ofG one-to-one onto the interval between the depths of its endpoints andmaps each cell ofM in such a way that the map has no local minima or maxima in the interior of thecell Partition the surface underlying the mapM into submanifolds with boundary by removing all points

10

x for which λ(x) = i mod k Then each submanifold is formed fromM by cutting certain curves at depthλ(x) = i + ak (for some integera) and certain other curves at depthλ(x) = i + (a+ 1)k If we cap off thesecut curves with disks we form a manifoldMa without boundary Within each of the added disks at depthλ(x) = i + ak add a vertex connected by edges to all the vertices on the boundary of the disk the result isa graphGa embedded inMa such that each edge and vertex inGSik belongs to exactly one of the graphsGa If we let Ta be formed from the union ofT cap Ga with the newly added edges inGa thenTa is a forestdisjoint from the coforestC cap Ga so we can extend these two subgraphs to a tree-cotree decomposition(Tprime

a Cprimea Xprime

a) such thatXprimea sub XcapGa Therefore the pathsPik(v) for v an endpoint of an edge inXcapGa form

a cutset forMa andSik is a cutset for all ofM ⊓⊔

Lemma 9 For any k and any map embedded on a surface with Euler characteristic χsum

0leiltk

|Sik| le n + (χ + 2)k(kminus 1)

Proof Each vertex of the map belongs to exactly one graphLik In addition each of the 2(χ+ 2) endpointsv of edges inX contributes

sum |Pik(v)| =sum

0leiltk i vertices to the total Some vertices may be in more thanone pathPik(v) but this only reduces the total ⊓⊔

Theorem 5 Any n-vertex graph G embedded on a surface with Euler characteristic χ has anǫ-separatorwith |S| le

radic

(4χ + O(1ǫ))n vertices

Proof By choosingi minimizing |Sik| we achieve|Sik| le nk+χk+O(k) The result follows by choosingk =

radic

nχ applying a planar separator theorem to the planar graphG Sik and forming the union of theplanar separator withSik ⊓⊔

If a map representing a characteristic-χ embedding ofG is given as input the method described in theproof of the theorem can be implemented to run in time linear in the size of the map and produces a cutsetof size at most

radic

(4χ + O(1))n The time bound for the overall algorithm and the constant factor in theradic

O(nǫ) term in the separator size depend on the choice of planar separator algorithm used to completethe separator construction

We note that not all loops need always be incorporated inSik in order to makeG Sik planar Forinstance ifG is embedded on a torus it can be cut into a planar graph in the form of a cylinder by removingonly one of the two loops In addition if we chooseSik in such a way that some of the subgraphsTa andC cap Ga described in the proof of Lemma 8 are disconnected then additional edges are removed fromX informing the tree-cotree decompositions ofMa and again we can reduce the number of loops Can we usethese observations to further reduce the constant factor inour separator theorem

6 Low-Diameter Tree Decomposition

In previous work [5] we showed that in a minor-closed graph family the treewidth of a graph with diameterD can be bounded by a function ofD if and only if the family excludes some apex graph For instance forplanar graphs (which exclude the apex graphK5) the treewidth is at most 3D minus O(1) [2] Suchboundedlocal treewidthresults can be used to find efficient solutions to many important algorithmic problems onthese graphs [2459]

In particular any graph embedded on a genusg = O(1) surface has bounded local treewidth since thefamily of such graphs is minor-closed and excludes an apex graph However the treewidth bound from thisgeneral result grows rapidly withg and in this special case we were able to prove a tighter bound

11

Theorem 6 (Eppstein [5])Let G have genus g and diameter D Then G has treewidthO(gD)

The proof relies on showing the existence of a cutset of sizeO(gD) and forming a tree-decompositionby adding this cutset to each node in a tree-decomposition ofthe remaining planar graph However one stepin the proof is to find the minimum cardinality cutset so the proof is nonconstructive and Erickson andSar-Peled [8] later showed that in fact finding minimum cutsets is NP-complete By replacing this step withmethods based on our tree-cotree decomposition we can turnthis nonconstructive proof into an efficientalgorithm

Theorem 7 Let G have genus g and diameter D and suppose that we are givenas input an embeddingMof G on a surface of genus g Then in timeO(gDn) we can find a tree-decomposition of G with treewidthO(gD)

Proof We form a tree-decomposition(T C X) by lettingT be a breadth-first spanning tree ofG and lettingC be any spanning cotree disjoint fromT We then letSbe the set of vertices incident to the edges in loopsloop(T e) | eisin X Each loop has at most 2D edges so|S| = O(gD) andG S is planar so it has a tree-decomposition of treewidth 3DminusO(1) that can be found in timeO(Dn) [2] We form a tree-decompositionof G by addingS to each node in the tree-decomposition ofG S ⊓⊔

TheO(gDn) time bound is optimal in the sense that it is the size of an explicit representation of theresulting tree-decomposition but if we represent the setsof vertices at each tree-decomposition node im-plicitly as a union of a constant number of paths in the two treesT andB the time can be reduced to linearin the size of the input mapM

7 Conclusions

We have shown how the tree-cotree decomposition can be used in several applications for graphs embeddedon surfaces maintaining dynamic properties of the graph computing separators and constructing tree-decompositions of small treewidth There are many other important planar graph algorithms that can begeneralized to graphs embedded on surfaces and it would be interesting to see which others of these can beimproved by the use of our tree-cotree decomposition methods

Acknowledgements

This research was supported in part by NSF grant CCR-9912338

References

1 L Aleksandrov and H Djidjev Linear algorithms for partitioning embedded graphs of bounded genusSIAM J DiscreteMath9129ndash150 1996 httpwwwdcswarwickacuksimhristopapersgenus-separatorpsZ

2 B S Baker Approximation algorithms for NP-complete problems on planar graphsJ Assoc Comput Mach41153ndash1801994

3 C P Bonnington and C H C LittleThe Foundations of Topological Graph Theory Springer-Verlag 19954 D Eppstein Subgraph isomorphism in planar graphs and related problemsJ Graph Algorithms amp Applications3(3)1ndash27

1999 arXivcsDS99110035 D Eppstein Diameter and treewidth in minor-closed graph familiesAlgorithmica27275ndash291 2000

httplinkspringer-nycomlinkservicejournals00453contents0010020 arXivmathCO99071266 D Eppstein Z Galil G F Italiano and T H Spencer Separator based sparsification I planarity testing and minimum

spanning treesJ Computing amp Systems Sciences52(1)3ndash27 February 19967 D Eppstein G F Italiano R Tamassia R E Tarjan J R Westbrook and M Yung Maintenance of a minimum spanning

forest in a dynamic planar graphJ Algorithms13(1)33ndash54 March 1992

12

8 J Erickson and S Har-Peled Optimally cutting a surfaceinto a diskProc 18th ACM Symp Computational Geometrypp 244ndash253 June 2002 httpcompgeomcsuiucedusimjeffepubsschemahtml arXivcsCG0207004

9 M Grohe Local tree-width excluded minors and approximation algorithms arXivorg e-Print archive January 2000arXivmathCO0001128

10 J L Gross and T W TuckerTopological Graph Theory Dover Publications 200111 M R Henzinger and V King Randomized fully dynamic graph algorithms with polylogarithmic time per operationJ ACM

46(4)502ndash536 July 199912 J Holm K de Lichtenberg and M Thorup Poly-logarithmic deterministic fully-dynamic graph algorithms for connectivity

minimum spanning tree 2-edge and biconnectivityJ ACM48(4)723ndash760 July 200113 S Lins Graph-encoded mapsJ Combinatorial Theory Ser B32171ndash181 198214 R Lipton and R E Tarjan A separator theorem for planargraphsSIAM J Applied Math36(2)177ndash189 April 197915 D D Sleator and R E Tarjan A data structure for dynamic treesJ Computing amp Systems Sciences26362ndash391 198316 D A Spielman and S-H Teng Disk packings and planar separatorsProc 12th ACM Symp Computational Geometry

pp 349ndash358 1996 httpwww-mathmitedusimspielmanResearchseparatorhtml17 J StillwellClassical Topology and Combinatorial Group Theory Graduate Texts in Mathematics 72 Springer-Verlag 2nd

edition 199318 M Thorup Near-optimal fully-dynamic graph connectivity Proc 32nd ACM Symp Theory of Computing pp 343ndash350 May

200019 G Vegter and C-K Yap Computational complexity of combinatorial surfacesProc 6th ACM Symp Computational

Geometry pp 102ndash111 1990 httpwwwacmorgpubscitationsproceedingscompgeom98524p102-vegter

13

Page 9: Dynamic Generators of Topologically Embedded Graphs

which vertex forms the branching point between the paths connecting the three vertex Second we maintainan Euler tour data structure [11] that can find for a query vertex in T the one or two nearest vertices thatbelong toTprime Whenever a change toX adds a vertexv to the set of endpoints inX we must also addvto Tprime we do this by querying the Euler tour data structure to find the edge or vertex ofTprime at which thebranch tov should be added querying the dynamic tree data structure tofind the correct branching point onthat edge giving the overall graph structure of the new treeTprime and finally querying the dynamic tree datastructure again to find the weights of the changed edges inTprime To remove a vertex from the endpoints inXwe simply contract one or two edges as necessary inTprime To perform a swap inT we use the data structuresas described above to make all swap endpoints part ofTprime perform the swap and then contract edges toremove unnecessary vertices from the changedTprime The updates toCprime are similar ⊓⊔

Lemma 5 Let e be an edge of T that was not contracted in forming Tprime and let eprime be an edge of X Thene eprime is a swap in T if and only if it is a swap in Tprime

Lemma 6 Let eprime be an edge in X and let e be the heaviest edge forming a swape eprime in T Then e is notcontracted in forming Tprime

Theorem 2 Let M be a map with distinct edge weights changing according to the update operationsdescribed in the previous section as well as by changes to theweights of the edges Then in amortizedtimeO(logn + (logg)4) per update we can maintain a tree-cotree decomposition(T C X) where T is theminimum spanning tree C is the maximum spanning cotree andg is the genus of the map at the time of theupdate operation

Proof The overall algorithm is the same as the one in Theorem 1 but we use the data structures describedabove to maintain treesTprime andCprime and use the dynamic minimum spanning tree data structure ofHolm etal [12] to find the edgeeprime isin X forming the best swap for any edgeeisin T or elowast isin Clowast The time bound followsfrom plugging theO(|X|) bound on the number of edges inTprime cup X andCprime cup Xlowast into the time bound forthe minimum spanning tree data structure and using this bound to replace theO(g logn) time for findingreplacement edges in Theorem 1 ⊓⊔

The final improvement to our bounds comes from the observation that if we only wish to maintain atree-cotree decomposition for a graph without weights then we can replace the dynamic minimum spanningtree data structures forTprime cup X andCprime cup X with any dynamic connectivity data structure that maintains aspanning tree of these two dynamic graphs and changes the tree by a single swap per update to the graphsThe connectivity structure of Holm et al [12] as improved byThorup [18] is a suitable replacement

Theorem 3 Let M be a map with distinct edge weights changing according to the update operationsdescribed in the previous section as well as by changes to theweights of the edges Then in amortized timeO(logn + logg(log logg)3) per update we can maintain a tree-cotree decomposition(T C X) where g isthe genus of the map at the time of the update operation

44 Orientability

The results above are nearly sufficient to determine the surface underlying the dynamic mapM since itis known that 2-dimensional closed surfaces are classified by two quantities their genus (which we cancalculate from|X|) and theorientability of the surface We can compute the orientability from the followingsimple result which follows from the fact that the loops generated by edges inX form a cutset

9

Lemma 7 LetM have a tree-cotree decomposition(T C X) Then The surface on whichM is embeddedis unorientable if and only if every sufficiently small neighborhood of at least one of the loopsloop(T e) |eisin X is homeomorphic to a Mobius strip

Theorem 4 Let M be a map with distinct edge weights changing according to the update operationsdescribed in the previous section as well as by changes to theweights of the edges Then in amortized timeO(logn+ logg(log logg)3) per update we can determine after each update whether the surface underlyingthe map is orientable

Proof For any path inM we can form a sufficiently small neighborhood of the path by gluing togethera collection of disks where each disk has as its boundary thegem cycle representing a vertex or edge inthe path We choose an arbitrary clockwise orientation for the gem cycle representing each vertex inMand augment the Sleator-Tarjan dynamic tree data structureused to maintain the treeT in the tree-cotreedecomposition(T C X) by storing an extra bit per tree edge that is zero when the edgersquos preserves thechosen orientations of its two endpoints and one when it reverses these orientations we can use the dynamictree data structure to determine the parity of the sum of these bits along any path inT After each changeto the tree-cotree decomposition we use this data structure to determine whether anye isin X forms a loopwith odd total parity (including the parity ofe itself) If any odd loop is found the map is unorientable ifall loops are even the map is orientable ⊓⊔

5 Separator Theorems

Since Lipton and Tarjanrsquos discovery of the planar separatortheorem [14] separator theorems have becomewidely used in algorithms and there has been much work on improved constants for these theorems For-mally we define anǫ-separator of ann-vertex graphG to be a subsetSof the vertices ofG such that eachconnected component ofGShas at mostǫn vertices For graphs embedded on a genus-g orientable surfaceAleksandrov and Djidjev [1] showed that there always existsanǫ-separator with|S| le

radic

(16g + O(1ǫ))nWe combine our tree-cotree decomposition idea with the Lipton-Tarjan method of partitioning the breadthfirst search tree into levels (also used by Aleksandrov and Djidjev) to improve this result and extend it tounorientable surfaces

By Eulerrsquos formula if(T C X) is a tree-cotree decomposition of a map on an orientable surface then|X| = 2g whereg is the genus of the surface on whichM is embedded If the surface is unorientablethen |X| = g Because of this confusion between orientable and unorientable surfaces we prefer to usetheEuler characteristicχ(M) = |X| minus 2 in stating our results In terms ofχ Aleksandrov and Djidjevrsquosresult is that there exists a separator with|S| le

radic

(8χ + O(1ǫ))n We improve this by a factor ofradic

2 to|S| le

radic

(4χ + O(1ǫ))nLet T be a breadth first search tree of the given graph and form a tree-cotree decomposition(T C X)

For any pair of integers 0le i lt k define vertex setsLik andSik as followsLik consists of all verticesvwhose depthd(v) in T satisfiesd(v) equiv i (mod k) Sik is formed by adding toLik a pathPik(v) for eachendpointv of an edge inX wherePik(v) sub T connectsv to the first member ofLik on the path fromv tothe root ofT

Lemma 8 For any i and k G Sik is planar

Proof Extend the depth function on vertices to a continuous function λ M 7rarr R that maps each vertexto its depth maps each edge ofG one-to-one onto the interval between the depths of its endpoints andmaps each cell ofM in such a way that the map has no local minima or maxima in the interior of thecell Partition the surface underlying the mapM into submanifolds with boundary by removing all points

10

x for which λ(x) = i mod k Then each submanifold is formed fromM by cutting certain curves at depthλ(x) = i + ak (for some integera) and certain other curves at depthλ(x) = i + (a+ 1)k If we cap off thesecut curves with disks we form a manifoldMa without boundary Within each of the added disks at depthλ(x) = i + ak add a vertex connected by edges to all the vertices on the boundary of the disk the result isa graphGa embedded inMa such that each edge and vertex inGSik belongs to exactly one of the graphsGa If we let Ta be formed from the union ofT cap Ga with the newly added edges inGa thenTa is a forestdisjoint from the coforestC cap Ga so we can extend these two subgraphs to a tree-cotree decomposition(Tprime

a Cprimea Xprime

a) such thatXprimea sub XcapGa Therefore the pathsPik(v) for v an endpoint of an edge inXcapGa form

a cutset forMa andSik is a cutset for all ofM ⊓⊔

Lemma 9 For any k and any map embedded on a surface with Euler characteristic χsum

0leiltk

|Sik| le n + (χ + 2)k(kminus 1)

Proof Each vertex of the map belongs to exactly one graphLik In addition each of the 2(χ+ 2) endpointsv of edges inX contributes

sum |Pik(v)| =sum

0leiltk i vertices to the total Some vertices may be in more thanone pathPik(v) but this only reduces the total ⊓⊔

Theorem 5 Any n-vertex graph G embedded on a surface with Euler characteristic χ has anǫ-separatorwith |S| le

radic

(4χ + O(1ǫ))n vertices

Proof By choosingi minimizing |Sik| we achieve|Sik| le nk+χk+O(k) The result follows by choosingk =

radic

nχ applying a planar separator theorem to the planar graphG Sik and forming the union of theplanar separator withSik ⊓⊔

If a map representing a characteristic-χ embedding ofG is given as input the method described in theproof of the theorem can be implemented to run in time linear in the size of the map and produces a cutsetof size at most

radic

(4χ + O(1))n The time bound for the overall algorithm and the constant factor in theradic

O(nǫ) term in the separator size depend on the choice of planar separator algorithm used to completethe separator construction

We note that not all loops need always be incorporated inSik in order to makeG Sik planar Forinstance ifG is embedded on a torus it can be cut into a planar graph in the form of a cylinder by removingonly one of the two loops In addition if we chooseSik in such a way that some of the subgraphsTa andC cap Ga described in the proof of Lemma 8 are disconnected then additional edges are removed fromX informing the tree-cotree decompositions ofMa and again we can reduce the number of loops Can we usethese observations to further reduce the constant factor inour separator theorem

6 Low-Diameter Tree Decomposition

In previous work [5] we showed that in a minor-closed graph family the treewidth of a graph with diameterD can be bounded by a function ofD if and only if the family excludes some apex graph For instance forplanar graphs (which exclude the apex graphK5) the treewidth is at most 3D minus O(1) [2] Suchboundedlocal treewidthresults can be used to find efficient solutions to many important algorithmic problems onthese graphs [2459]

In particular any graph embedded on a genusg = O(1) surface has bounded local treewidth since thefamily of such graphs is minor-closed and excludes an apex graph However the treewidth bound from thisgeneral result grows rapidly withg and in this special case we were able to prove a tighter bound

11

Theorem 6 (Eppstein [5])Let G have genus g and diameter D Then G has treewidthO(gD)

The proof relies on showing the existence of a cutset of sizeO(gD) and forming a tree-decompositionby adding this cutset to each node in a tree-decomposition ofthe remaining planar graph However one stepin the proof is to find the minimum cardinality cutset so the proof is nonconstructive and Erickson andSar-Peled [8] later showed that in fact finding minimum cutsets is NP-complete By replacing this step withmethods based on our tree-cotree decomposition we can turnthis nonconstructive proof into an efficientalgorithm

Theorem 7 Let G have genus g and diameter D and suppose that we are givenas input an embeddingMof G on a surface of genus g Then in timeO(gDn) we can find a tree-decomposition of G with treewidthO(gD)

Proof We form a tree-decomposition(T C X) by lettingT be a breadth-first spanning tree ofG and lettingC be any spanning cotree disjoint fromT We then letSbe the set of vertices incident to the edges in loopsloop(T e) | eisin X Each loop has at most 2D edges so|S| = O(gD) andG S is planar so it has a tree-decomposition of treewidth 3DminusO(1) that can be found in timeO(Dn) [2] We form a tree-decompositionof G by addingS to each node in the tree-decomposition ofG S ⊓⊔

TheO(gDn) time bound is optimal in the sense that it is the size of an explicit representation of theresulting tree-decomposition but if we represent the setsof vertices at each tree-decomposition node im-plicitly as a union of a constant number of paths in the two treesT andB the time can be reduced to linearin the size of the input mapM

7 Conclusions

We have shown how the tree-cotree decomposition can be used in several applications for graphs embeddedon surfaces maintaining dynamic properties of the graph computing separators and constructing tree-decompositions of small treewidth There are many other important planar graph algorithms that can begeneralized to graphs embedded on surfaces and it would be interesting to see which others of these can beimproved by the use of our tree-cotree decomposition methods

Acknowledgements

This research was supported in part by NSF grant CCR-9912338

References

1 L Aleksandrov and H Djidjev Linear algorithms for partitioning embedded graphs of bounded genusSIAM J DiscreteMath9129ndash150 1996 httpwwwdcswarwickacuksimhristopapersgenus-separatorpsZ

2 B S Baker Approximation algorithms for NP-complete problems on planar graphsJ Assoc Comput Mach41153ndash1801994

3 C P Bonnington and C H C LittleThe Foundations of Topological Graph Theory Springer-Verlag 19954 D Eppstein Subgraph isomorphism in planar graphs and related problemsJ Graph Algorithms amp Applications3(3)1ndash27

1999 arXivcsDS99110035 D Eppstein Diameter and treewidth in minor-closed graph familiesAlgorithmica27275ndash291 2000

httplinkspringer-nycomlinkservicejournals00453contents0010020 arXivmathCO99071266 D Eppstein Z Galil G F Italiano and T H Spencer Separator based sparsification I planarity testing and minimum

spanning treesJ Computing amp Systems Sciences52(1)3ndash27 February 19967 D Eppstein G F Italiano R Tamassia R E Tarjan J R Westbrook and M Yung Maintenance of a minimum spanning

forest in a dynamic planar graphJ Algorithms13(1)33ndash54 March 1992

12

8 J Erickson and S Har-Peled Optimally cutting a surfaceinto a diskProc 18th ACM Symp Computational Geometrypp 244ndash253 June 2002 httpcompgeomcsuiucedusimjeffepubsschemahtml arXivcsCG0207004

9 M Grohe Local tree-width excluded minors and approximation algorithms arXivorg e-Print archive January 2000arXivmathCO0001128

10 J L Gross and T W TuckerTopological Graph Theory Dover Publications 200111 M R Henzinger and V King Randomized fully dynamic graph algorithms with polylogarithmic time per operationJ ACM

46(4)502ndash536 July 199912 J Holm K de Lichtenberg and M Thorup Poly-logarithmic deterministic fully-dynamic graph algorithms for connectivity

minimum spanning tree 2-edge and biconnectivityJ ACM48(4)723ndash760 July 200113 S Lins Graph-encoded mapsJ Combinatorial Theory Ser B32171ndash181 198214 R Lipton and R E Tarjan A separator theorem for planargraphsSIAM J Applied Math36(2)177ndash189 April 197915 D D Sleator and R E Tarjan A data structure for dynamic treesJ Computing amp Systems Sciences26362ndash391 198316 D A Spielman and S-H Teng Disk packings and planar separatorsProc 12th ACM Symp Computational Geometry

pp 349ndash358 1996 httpwww-mathmitedusimspielmanResearchseparatorhtml17 J StillwellClassical Topology and Combinatorial Group Theory Graduate Texts in Mathematics 72 Springer-Verlag 2nd

edition 199318 M Thorup Near-optimal fully-dynamic graph connectivity Proc 32nd ACM Symp Theory of Computing pp 343ndash350 May

200019 G Vegter and C-K Yap Computational complexity of combinatorial surfacesProc 6th ACM Symp Computational

Geometry pp 102ndash111 1990 httpwwwacmorgpubscitationsproceedingscompgeom98524p102-vegter

13

Page 10: Dynamic Generators of Topologically Embedded Graphs

Lemma 7 LetM have a tree-cotree decomposition(T C X) Then The surface on whichM is embeddedis unorientable if and only if every sufficiently small neighborhood of at least one of the loopsloop(T e) |eisin X is homeomorphic to a Mobius strip

Theorem 4 Let M be a map with distinct edge weights changing according to the update operationsdescribed in the previous section as well as by changes to theweights of the edges Then in amortized timeO(logn+ logg(log logg)3) per update we can determine after each update whether the surface underlyingthe map is orientable

Proof For any path inM we can form a sufficiently small neighborhood of the path by gluing togethera collection of disks where each disk has as its boundary thegem cycle representing a vertex or edge inthe path We choose an arbitrary clockwise orientation for the gem cycle representing each vertex inMand augment the Sleator-Tarjan dynamic tree data structureused to maintain the treeT in the tree-cotreedecomposition(T C X) by storing an extra bit per tree edge that is zero when the edgersquos preserves thechosen orientations of its two endpoints and one when it reverses these orientations we can use the dynamictree data structure to determine the parity of the sum of these bits along any path inT After each changeto the tree-cotree decomposition we use this data structure to determine whether anye isin X forms a loopwith odd total parity (including the parity ofe itself) If any odd loop is found the map is unorientable ifall loops are even the map is orientable ⊓⊔

5 Separator Theorems

Since Lipton and Tarjanrsquos discovery of the planar separatortheorem [14] separator theorems have becomewidely used in algorithms and there has been much work on improved constants for these theorems For-mally we define anǫ-separator of ann-vertex graphG to be a subsetSof the vertices ofG such that eachconnected component ofGShas at mostǫn vertices For graphs embedded on a genus-g orientable surfaceAleksandrov and Djidjev [1] showed that there always existsanǫ-separator with|S| le

radic

(16g + O(1ǫ))nWe combine our tree-cotree decomposition idea with the Lipton-Tarjan method of partitioning the breadthfirst search tree into levels (also used by Aleksandrov and Djidjev) to improve this result and extend it tounorientable surfaces

By Eulerrsquos formula if(T C X) is a tree-cotree decomposition of a map on an orientable surface then|X| = 2g whereg is the genus of the surface on whichM is embedded If the surface is unorientablethen |X| = g Because of this confusion between orientable and unorientable surfaces we prefer to usetheEuler characteristicχ(M) = |X| minus 2 in stating our results In terms ofχ Aleksandrov and Djidjevrsquosresult is that there exists a separator with|S| le

radic

(8χ + O(1ǫ))n We improve this by a factor ofradic

2 to|S| le

radic

(4χ + O(1ǫ))nLet T be a breadth first search tree of the given graph and form a tree-cotree decomposition(T C X)

For any pair of integers 0le i lt k define vertex setsLik andSik as followsLik consists of all verticesvwhose depthd(v) in T satisfiesd(v) equiv i (mod k) Sik is formed by adding toLik a pathPik(v) for eachendpointv of an edge inX wherePik(v) sub T connectsv to the first member ofLik on the path fromv tothe root ofT

Lemma 8 For any i and k G Sik is planar

Proof Extend the depth function on vertices to a continuous function λ M 7rarr R that maps each vertexto its depth maps each edge ofG one-to-one onto the interval between the depths of its endpoints andmaps each cell ofM in such a way that the map has no local minima or maxima in the interior of thecell Partition the surface underlying the mapM into submanifolds with boundary by removing all points

10

x for which λ(x) = i mod k Then each submanifold is formed fromM by cutting certain curves at depthλ(x) = i + ak (for some integera) and certain other curves at depthλ(x) = i + (a+ 1)k If we cap off thesecut curves with disks we form a manifoldMa without boundary Within each of the added disks at depthλ(x) = i + ak add a vertex connected by edges to all the vertices on the boundary of the disk the result isa graphGa embedded inMa such that each edge and vertex inGSik belongs to exactly one of the graphsGa If we let Ta be formed from the union ofT cap Ga with the newly added edges inGa thenTa is a forestdisjoint from the coforestC cap Ga so we can extend these two subgraphs to a tree-cotree decomposition(Tprime

a Cprimea Xprime

a) such thatXprimea sub XcapGa Therefore the pathsPik(v) for v an endpoint of an edge inXcapGa form

a cutset forMa andSik is a cutset for all ofM ⊓⊔

Lemma 9 For any k and any map embedded on a surface with Euler characteristic χsum

0leiltk

|Sik| le n + (χ + 2)k(kminus 1)

Proof Each vertex of the map belongs to exactly one graphLik In addition each of the 2(χ+ 2) endpointsv of edges inX contributes

sum |Pik(v)| =sum

0leiltk i vertices to the total Some vertices may be in more thanone pathPik(v) but this only reduces the total ⊓⊔

Theorem 5 Any n-vertex graph G embedded on a surface with Euler characteristic χ has anǫ-separatorwith |S| le

radic

(4χ + O(1ǫ))n vertices

Proof By choosingi minimizing |Sik| we achieve|Sik| le nk+χk+O(k) The result follows by choosingk =

radic

nχ applying a planar separator theorem to the planar graphG Sik and forming the union of theplanar separator withSik ⊓⊔

If a map representing a characteristic-χ embedding ofG is given as input the method described in theproof of the theorem can be implemented to run in time linear in the size of the map and produces a cutsetof size at most

radic

(4χ + O(1))n The time bound for the overall algorithm and the constant factor in theradic

O(nǫ) term in the separator size depend on the choice of planar separator algorithm used to completethe separator construction

We note that not all loops need always be incorporated inSik in order to makeG Sik planar Forinstance ifG is embedded on a torus it can be cut into a planar graph in the form of a cylinder by removingonly one of the two loops In addition if we chooseSik in such a way that some of the subgraphsTa andC cap Ga described in the proof of Lemma 8 are disconnected then additional edges are removed fromX informing the tree-cotree decompositions ofMa and again we can reduce the number of loops Can we usethese observations to further reduce the constant factor inour separator theorem

6 Low-Diameter Tree Decomposition

In previous work [5] we showed that in a minor-closed graph family the treewidth of a graph with diameterD can be bounded by a function ofD if and only if the family excludes some apex graph For instance forplanar graphs (which exclude the apex graphK5) the treewidth is at most 3D minus O(1) [2] Suchboundedlocal treewidthresults can be used to find efficient solutions to many important algorithmic problems onthese graphs [2459]

In particular any graph embedded on a genusg = O(1) surface has bounded local treewidth since thefamily of such graphs is minor-closed and excludes an apex graph However the treewidth bound from thisgeneral result grows rapidly withg and in this special case we were able to prove a tighter bound

11

Theorem 6 (Eppstein [5])Let G have genus g and diameter D Then G has treewidthO(gD)

The proof relies on showing the existence of a cutset of sizeO(gD) and forming a tree-decompositionby adding this cutset to each node in a tree-decomposition ofthe remaining planar graph However one stepin the proof is to find the minimum cardinality cutset so the proof is nonconstructive and Erickson andSar-Peled [8] later showed that in fact finding minimum cutsets is NP-complete By replacing this step withmethods based on our tree-cotree decomposition we can turnthis nonconstructive proof into an efficientalgorithm

Theorem 7 Let G have genus g and diameter D and suppose that we are givenas input an embeddingMof G on a surface of genus g Then in timeO(gDn) we can find a tree-decomposition of G with treewidthO(gD)

Proof We form a tree-decomposition(T C X) by lettingT be a breadth-first spanning tree ofG and lettingC be any spanning cotree disjoint fromT We then letSbe the set of vertices incident to the edges in loopsloop(T e) | eisin X Each loop has at most 2D edges so|S| = O(gD) andG S is planar so it has a tree-decomposition of treewidth 3DminusO(1) that can be found in timeO(Dn) [2] We form a tree-decompositionof G by addingS to each node in the tree-decomposition ofG S ⊓⊔

TheO(gDn) time bound is optimal in the sense that it is the size of an explicit representation of theresulting tree-decomposition but if we represent the setsof vertices at each tree-decomposition node im-plicitly as a union of a constant number of paths in the two treesT andB the time can be reduced to linearin the size of the input mapM

7 Conclusions

We have shown how the tree-cotree decomposition can be used in several applications for graphs embeddedon surfaces maintaining dynamic properties of the graph computing separators and constructing tree-decompositions of small treewidth There are many other important planar graph algorithms that can begeneralized to graphs embedded on surfaces and it would be interesting to see which others of these can beimproved by the use of our tree-cotree decomposition methods

Acknowledgements

This research was supported in part by NSF grant CCR-9912338

References

1 L Aleksandrov and H Djidjev Linear algorithms for partitioning embedded graphs of bounded genusSIAM J DiscreteMath9129ndash150 1996 httpwwwdcswarwickacuksimhristopapersgenus-separatorpsZ

2 B S Baker Approximation algorithms for NP-complete problems on planar graphsJ Assoc Comput Mach41153ndash1801994

3 C P Bonnington and C H C LittleThe Foundations of Topological Graph Theory Springer-Verlag 19954 D Eppstein Subgraph isomorphism in planar graphs and related problemsJ Graph Algorithms amp Applications3(3)1ndash27

1999 arXivcsDS99110035 D Eppstein Diameter and treewidth in minor-closed graph familiesAlgorithmica27275ndash291 2000

httplinkspringer-nycomlinkservicejournals00453contents0010020 arXivmathCO99071266 D Eppstein Z Galil G F Italiano and T H Spencer Separator based sparsification I planarity testing and minimum

spanning treesJ Computing amp Systems Sciences52(1)3ndash27 February 19967 D Eppstein G F Italiano R Tamassia R E Tarjan J R Westbrook and M Yung Maintenance of a minimum spanning

forest in a dynamic planar graphJ Algorithms13(1)33ndash54 March 1992

12

8 J Erickson and S Har-Peled Optimally cutting a surfaceinto a diskProc 18th ACM Symp Computational Geometrypp 244ndash253 June 2002 httpcompgeomcsuiucedusimjeffepubsschemahtml arXivcsCG0207004

9 M Grohe Local tree-width excluded minors and approximation algorithms arXivorg e-Print archive January 2000arXivmathCO0001128

10 J L Gross and T W TuckerTopological Graph Theory Dover Publications 200111 M R Henzinger and V King Randomized fully dynamic graph algorithms with polylogarithmic time per operationJ ACM

46(4)502ndash536 July 199912 J Holm K de Lichtenberg and M Thorup Poly-logarithmic deterministic fully-dynamic graph algorithms for connectivity

minimum spanning tree 2-edge and biconnectivityJ ACM48(4)723ndash760 July 200113 S Lins Graph-encoded mapsJ Combinatorial Theory Ser B32171ndash181 198214 R Lipton and R E Tarjan A separator theorem for planargraphsSIAM J Applied Math36(2)177ndash189 April 197915 D D Sleator and R E Tarjan A data structure for dynamic treesJ Computing amp Systems Sciences26362ndash391 198316 D A Spielman and S-H Teng Disk packings and planar separatorsProc 12th ACM Symp Computational Geometry

pp 349ndash358 1996 httpwww-mathmitedusimspielmanResearchseparatorhtml17 J StillwellClassical Topology and Combinatorial Group Theory Graduate Texts in Mathematics 72 Springer-Verlag 2nd

edition 199318 M Thorup Near-optimal fully-dynamic graph connectivity Proc 32nd ACM Symp Theory of Computing pp 343ndash350 May

200019 G Vegter and C-K Yap Computational complexity of combinatorial surfacesProc 6th ACM Symp Computational

Geometry pp 102ndash111 1990 httpwwwacmorgpubscitationsproceedingscompgeom98524p102-vegter

13

Page 11: Dynamic Generators of Topologically Embedded Graphs

x for which λ(x) = i mod k Then each submanifold is formed fromM by cutting certain curves at depthλ(x) = i + ak (for some integera) and certain other curves at depthλ(x) = i + (a+ 1)k If we cap off thesecut curves with disks we form a manifoldMa without boundary Within each of the added disks at depthλ(x) = i + ak add a vertex connected by edges to all the vertices on the boundary of the disk the result isa graphGa embedded inMa such that each edge and vertex inGSik belongs to exactly one of the graphsGa If we let Ta be formed from the union ofT cap Ga with the newly added edges inGa thenTa is a forestdisjoint from the coforestC cap Ga so we can extend these two subgraphs to a tree-cotree decomposition(Tprime

a Cprimea Xprime

a) such thatXprimea sub XcapGa Therefore the pathsPik(v) for v an endpoint of an edge inXcapGa form

a cutset forMa andSik is a cutset for all ofM ⊓⊔

Lemma 9 For any k and any map embedded on a surface with Euler characteristic χsum

0leiltk

|Sik| le n + (χ + 2)k(kminus 1)

Proof Each vertex of the map belongs to exactly one graphLik In addition each of the 2(χ+ 2) endpointsv of edges inX contributes

sum |Pik(v)| =sum

0leiltk i vertices to the total Some vertices may be in more thanone pathPik(v) but this only reduces the total ⊓⊔

Theorem 5 Any n-vertex graph G embedded on a surface with Euler characteristic χ has anǫ-separatorwith |S| le

radic

(4χ + O(1ǫ))n vertices

Proof By choosingi minimizing |Sik| we achieve|Sik| le nk+χk+O(k) The result follows by choosingk =

radic

nχ applying a planar separator theorem to the planar graphG Sik and forming the union of theplanar separator withSik ⊓⊔

If a map representing a characteristic-χ embedding ofG is given as input the method described in theproof of the theorem can be implemented to run in time linear in the size of the map and produces a cutsetof size at most

radic

(4χ + O(1))n The time bound for the overall algorithm and the constant factor in theradic

O(nǫ) term in the separator size depend on the choice of planar separator algorithm used to completethe separator construction

We note that not all loops need always be incorporated inSik in order to makeG Sik planar Forinstance ifG is embedded on a torus it can be cut into a planar graph in the form of a cylinder by removingonly one of the two loops In addition if we chooseSik in such a way that some of the subgraphsTa andC cap Ga described in the proof of Lemma 8 are disconnected then additional edges are removed fromX informing the tree-cotree decompositions ofMa and again we can reduce the number of loops Can we usethese observations to further reduce the constant factor inour separator theorem

6 Low-Diameter Tree Decomposition

In previous work [5] we showed that in a minor-closed graph family the treewidth of a graph with diameterD can be bounded by a function ofD if and only if the family excludes some apex graph For instance forplanar graphs (which exclude the apex graphK5) the treewidth is at most 3D minus O(1) [2] Suchboundedlocal treewidthresults can be used to find efficient solutions to many important algorithmic problems onthese graphs [2459]

In particular any graph embedded on a genusg = O(1) surface has bounded local treewidth since thefamily of such graphs is minor-closed and excludes an apex graph However the treewidth bound from thisgeneral result grows rapidly withg and in this special case we were able to prove a tighter bound

11

Theorem 6 (Eppstein [5])Let G have genus g and diameter D Then G has treewidthO(gD)

The proof relies on showing the existence of a cutset of sizeO(gD) and forming a tree-decompositionby adding this cutset to each node in a tree-decomposition ofthe remaining planar graph However one stepin the proof is to find the minimum cardinality cutset so the proof is nonconstructive and Erickson andSar-Peled [8] later showed that in fact finding minimum cutsets is NP-complete By replacing this step withmethods based on our tree-cotree decomposition we can turnthis nonconstructive proof into an efficientalgorithm

Theorem 7 Let G have genus g and diameter D and suppose that we are givenas input an embeddingMof G on a surface of genus g Then in timeO(gDn) we can find a tree-decomposition of G with treewidthO(gD)

Proof We form a tree-decomposition(T C X) by lettingT be a breadth-first spanning tree ofG and lettingC be any spanning cotree disjoint fromT We then letSbe the set of vertices incident to the edges in loopsloop(T e) | eisin X Each loop has at most 2D edges so|S| = O(gD) andG S is planar so it has a tree-decomposition of treewidth 3DminusO(1) that can be found in timeO(Dn) [2] We form a tree-decompositionof G by addingS to each node in the tree-decomposition ofG S ⊓⊔

TheO(gDn) time bound is optimal in the sense that it is the size of an explicit representation of theresulting tree-decomposition but if we represent the setsof vertices at each tree-decomposition node im-plicitly as a union of a constant number of paths in the two treesT andB the time can be reduced to linearin the size of the input mapM

7 Conclusions

We have shown how the tree-cotree decomposition can be used in several applications for graphs embeddedon surfaces maintaining dynamic properties of the graph computing separators and constructing tree-decompositions of small treewidth There are many other important planar graph algorithms that can begeneralized to graphs embedded on surfaces and it would be interesting to see which others of these can beimproved by the use of our tree-cotree decomposition methods

Acknowledgements

This research was supported in part by NSF grant CCR-9912338

References

1 L Aleksandrov and H Djidjev Linear algorithms for partitioning embedded graphs of bounded genusSIAM J DiscreteMath9129ndash150 1996 httpwwwdcswarwickacuksimhristopapersgenus-separatorpsZ

2 B S Baker Approximation algorithms for NP-complete problems on planar graphsJ Assoc Comput Mach41153ndash1801994

3 C P Bonnington and C H C LittleThe Foundations of Topological Graph Theory Springer-Verlag 19954 D Eppstein Subgraph isomorphism in planar graphs and related problemsJ Graph Algorithms amp Applications3(3)1ndash27

1999 arXivcsDS99110035 D Eppstein Diameter and treewidth in minor-closed graph familiesAlgorithmica27275ndash291 2000

httplinkspringer-nycomlinkservicejournals00453contents0010020 arXivmathCO99071266 D Eppstein Z Galil G F Italiano and T H Spencer Separator based sparsification I planarity testing and minimum

spanning treesJ Computing amp Systems Sciences52(1)3ndash27 February 19967 D Eppstein G F Italiano R Tamassia R E Tarjan J R Westbrook and M Yung Maintenance of a minimum spanning

forest in a dynamic planar graphJ Algorithms13(1)33ndash54 March 1992

12

8 J Erickson and S Har-Peled Optimally cutting a surfaceinto a diskProc 18th ACM Symp Computational Geometrypp 244ndash253 June 2002 httpcompgeomcsuiucedusimjeffepubsschemahtml arXivcsCG0207004

9 M Grohe Local tree-width excluded minors and approximation algorithms arXivorg e-Print archive January 2000arXivmathCO0001128

10 J L Gross and T W TuckerTopological Graph Theory Dover Publications 200111 M R Henzinger and V King Randomized fully dynamic graph algorithms with polylogarithmic time per operationJ ACM

46(4)502ndash536 July 199912 J Holm K de Lichtenberg and M Thorup Poly-logarithmic deterministic fully-dynamic graph algorithms for connectivity

minimum spanning tree 2-edge and biconnectivityJ ACM48(4)723ndash760 July 200113 S Lins Graph-encoded mapsJ Combinatorial Theory Ser B32171ndash181 198214 R Lipton and R E Tarjan A separator theorem for planargraphsSIAM J Applied Math36(2)177ndash189 April 197915 D D Sleator and R E Tarjan A data structure for dynamic treesJ Computing amp Systems Sciences26362ndash391 198316 D A Spielman and S-H Teng Disk packings and planar separatorsProc 12th ACM Symp Computational Geometry

pp 349ndash358 1996 httpwww-mathmitedusimspielmanResearchseparatorhtml17 J StillwellClassical Topology and Combinatorial Group Theory Graduate Texts in Mathematics 72 Springer-Verlag 2nd

edition 199318 M Thorup Near-optimal fully-dynamic graph connectivity Proc 32nd ACM Symp Theory of Computing pp 343ndash350 May

200019 G Vegter and C-K Yap Computational complexity of combinatorial surfacesProc 6th ACM Symp Computational

Geometry pp 102ndash111 1990 httpwwwacmorgpubscitationsproceedingscompgeom98524p102-vegter

13

Page 12: Dynamic Generators of Topologically Embedded Graphs

Theorem 6 (Eppstein [5])Let G have genus g and diameter D Then G has treewidthO(gD)

The proof relies on showing the existence of a cutset of sizeO(gD) and forming a tree-decompositionby adding this cutset to each node in a tree-decomposition ofthe remaining planar graph However one stepin the proof is to find the minimum cardinality cutset so the proof is nonconstructive and Erickson andSar-Peled [8] later showed that in fact finding minimum cutsets is NP-complete By replacing this step withmethods based on our tree-cotree decomposition we can turnthis nonconstructive proof into an efficientalgorithm

Theorem 7 Let G have genus g and diameter D and suppose that we are givenas input an embeddingMof G on a surface of genus g Then in timeO(gDn) we can find a tree-decomposition of G with treewidthO(gD)

Proof We form a tree-decomposition(T C X) by lettingT be a breadth-first spanning tree ofG and lettingC be any spanning cotree disjoint fromT We then letSbe the set of vertices incident to the edges in loopsloop(T e) | eisin X Each loop has at most 2D edges so|S| = O(gD) andG S is planar so it has a tree-decomposition of treewidth 3DminusO(1) that can be found in timeO(Dn) [2] We form a tree-decompositionof G by addingS to each node in the tree-decomposition ofG S ⊓⊔

TheO(gDn) time bound is optimal in the sense that it is the size of an explicit representation of theresulting tree-decomposition but if we represent the setsof vertices at each tree-decomposition node im-plicitly as a union of a constant number of paths in the two treesT andB the time can be reduced to linearin the size of the input mapM

7 Conclusions

We have shown how the tree-cotree decomposition can be used in several applications for graphs embeddedon surfaces maintaining dynamic properties of the graph computing separators and constructing tree-decompositions of small treewidth There are many other important planar graph algorithms that can begeneralized to graphs embedded on surfaces and it would be interesting to see which others of these can beimproved by the use of our tree-cotree decomposition methods

Acknowledgements

This research was supported in part by NSF grant CCR-9912338

References

1 L Aleksandrov and H Djidjev Linear algorithms for partitioning embedded graphs of bounded genusSIAM J DiscreteMath9129ndash150 1996 httpwwwdcswarwickacuksimhristopapersgenus-separatorpsZ

2 B S Baker Approximation algorithms for NP-complete problems on planar graphsJ Assoc Comput Mach41153ndash1801994

3 C P Bonnington and C H C LittleThe Foundations of Topological Graph Theory Springer-Verlag 19954 D Eppstein Subgraph isomorphism in planar graphs and related problemsJ Graph Algorithms amp Applications3(3)1ndash27

1999 arXivcsDS99110035 D Eppstein Diameter and treewidth in minor-closed graph familiesAlgorithmica27275ndash291 2000

httplinkspringer-nycomlinkservicejournals00453contents0010020 arXivmathCO99071266 D Eppstein Z Galil G F Italiano and T H Spencer Separator based sparsification I planarity testing and minimum

spanning treesJ Computing amp Systems Sciences52(1)3ndash27 February 19967 D Eppstein G F Italiano R Tamassia R E Tarjan J R Westbrook and M Yung Maintenance of a minimum spanning

forest in a dynamic planar graphJ Algorithms13(1)33ndash54 March 1992

12

8 J Erickson and S Har-Peled Optimally cutting a surfaceinto a diskProc 18th ACM Symp Computational Geometrypp 244ndash253 June 2002 httpcompgeomcsuiucedusimjeffepubsschemahtml arXivcsCG0207004

9 M Grohe Local tree-width excluded minors and approximation algorithms arXivorg e-Print archive January 2000arXivmathCO0001128

10 J L Gross and T W TuckerTopological Graph Theory Dover Publications 200111 M R Henzinger and V King Randomized fully dynamic graph algorithms with polylogarithmic time per operationJ ACM

46(4)502ndash536 July 199912 J Holm K de Lichtenberg and M Thorup Poly-logarithmic deterministic fully-dynamic graph algorithms for connectivity

minimum spanning tree 2-edge and biconnectivityJ ACM48(4)723ndash760 July 200113 S Lins Graph-encoded mapsJ Combinatorial Theory Ser B32171ndash181 198214 R Lipton and R E Tarjan A separator theorem for planargraphsSIAM J Applied Math36(2)177ndash189 April 197915 D D Sleator and R E Tarjan A data structure for dynamic treesJ Computing amp Systems Sciences26362ndash391 198316 D A Spielman and S-H Teng Disk packings and planar separatorsProc 12th ACM Symp Computational Geometry

pp 349ndash358 1996 httpwww-mathmitedusimspielmanResearchseparatorhtml17 J StillwellClassical Topology and Combinatorial Group Theory Graduate Texts in Mathematics 72 Springer-Verlag 2nd

edition 199318 M Thorup Near-optimal fully-dynamic graph connectivity Proc 32nd ACM Symp Theory of Computing pp 343ndash350 May

200019 G Vegter and C-K Yap Computational complexity of combinatorial surfacesProc 6th ACM Symp Computational

Geometry pp 102ndash111 1990 httpwwwacmorgpubscitationsproceedingscompgeom98524p102-vegter

13

Page 13: Dynamic Generators of Topologically Embedded Graphs

8 J Erickson and S Har-Peled Optimally cutting a surfaceinto a diskProc 18th ACM Symp Computational Geometrypp 244ndash253 June 2002 httpcompgeomcsuiucedusimjeffepubsschemahtml arXivcsCG0207004

9 M Grohe Local tree-width excluded minors and approximation algorithms arXivorg e-Print archive January 2000arXivmathCO0001128

10 J L Gross and T W TuckerTopological Graph Theory Dover Publications 200111 M R Henzinger and V King Randomized fully dynamic graph algorithms with polylogarithmic time per operationJ ACM

46(4)502ndash536 July 199912 J Holm K de Lichtenberg and M Thorup Poly-logarithmic deterministic fully-dynamic graph algorithms for connectivity

minimum spanning tree 2-edge and biconnectivityJ ACM48(4)723ndash760 July 200113 S Lins Graph-encoded mapsJ Combinatorial Theory Ser B32171ndash181 198214 R Lipton and R E Tarjan A separator theorem for planargraphsSIAM J Applied Math36(2)177ndash189 April 197915 D D Sleator and R E Tarjan A data structure for dynamic treesJ Computing amp Systems Sciences26362ndash391 198316 D A Spielman and S-H Teng Disk packings and planar separatorsProc 12th ACM Symp Computational Geometry

pp 349ndash358 1996 httpwww-mathmitedusimspielmanResearchseparatorhtml17 J StillwellClassical Topology and Combinatorial Group Theory Graduate Texts in Mathematics 72 Springer-Verlag 2nd

edition 199318 M Thorup Near-optimal fully-dynamic graph connectivity Proc 32nd ACM Symp Theory of Computing pp 343ndash350 May

200019 G Vegter and C-K Yap Computational complexity of combinatorial surfacesProc 6th ACM Symp Computational

Geometry pp 102ndash111 1990 httpwwwacmorgpubscitationsproceedingscompgeom98524p102-vegter

13