Finding Shortest NonSeparating and NonContractible Cycles for Topologically Embedded Graphs
Discrete Comput Geom
Geometry Discrete & Computational
Sergio Cabello 1
Bojan Mohar 0
0 Department of Mathematics, Faculty of Mathematics and Physics, University of Ljubljana , 1000 Ljubljana , Slovenia
1 Department of Mathematics, Institute for Mathematics , Physics and Mechanics , University of Ljubljana , 1000 Ljubljana , Slovenia
We present an algorithm for finding shortest surface nonseparating cycles in graphs embedded on surfaces in O(g3/2 V 3/2 log V + g5/2 V 1/2) time, where V is the number of vertices in the graph and g is the genus of the surface. If g = o(V 1/3), this represents an improvement over previous results by Thomassen, and Erickson and HarPeled. We also give algorithms to find a shortest noncontractible cycle in O(gO(g) V 3/2) time, which improves previous results for fixed genus. This result can be applied for computing the facewidth and the nonseparating facewidth of embedded graphs. Using similar ideas we provide the first nearlinear running time algorithm for computing the facewidth of a graph embedded on the projective plane, and an algorithm to find the facewidth of embedded toroidal graphs in O(V 5/4 log V ) time. ∗ A preliminary version was presented at the 13th Annual European Symposium on Algorithms (ESA 2005) [2]. Sergio Cabello was partially supported by the European Community Sixth Framework Programme under a Marie Curie IntraEuropean Fellowship. Bojan Mohar was supported in part by the Ministry of Higher Education, Science and Technology of Slovenia, Research Project L15014 and Research Program P10297.

Cutting a surface for reducing its topological complexity is a common technique used in
geometric computing and topological graph theory. Erickson and HarPeled [
10
] discuss
the relevance of cutting a surface to get a topological disk in computer graphics. Colin
de Verdie`re [
3
] describes applications that algorithmical problems involving curves on
topological surfaces have in other fields.
Many results in topological graph theory rely on the concept of facewidth, sometimes
called representativity, which is a parameter that quantifies local planarity and density of
embeddings. The facewidth is closely related to the edgewidth, the minimum number of
vertices of any shortest noncontractible cycle of an embedded graph [
20
]. Among some
relevant applications, facewidth plays a fundamental role in the graph minors theory of
Robertson and Seymour, and large facewidth implies that there exists a collection of
cycles that are far apart from each other, and after cutting along them, a planar graph is
obtained. By doing so, many computational problems for locally planar graphs on general
surfaces can be reduced to corresponding problems on planar graphs. See Chapter 5 of
[
20
] for further details. The efficiency of algorithmical counterparts of several of these
results passes through the efficient computation of facewidth. The same can be said
for the nonseparating counterparts of the width parameters, where the surface
nonseparating cycles are considered instead of noncontractible ones.
In this work we focus on what may be considered the most natural problem for
graphs embedded on surfaces: finding a shortest noncontractible and a shortest surface
nonseparating cycle. Our results give polynomialtime improvements over previous
algorithms for lowgenus embeddings of graphs (in the nonseparating case) or for
embeddings of graphs in a fixed surface (in the noncontractible case). In particular,
we improve previous algorithms for computing the facewidth and the edgewidth of
embedded graphs. In our approach we reduce the problem to that of computing the
distance between a few pairs of vertices, what some authors have called the kpairs
shortest path problem.
1.1. Overview of the Results
Let G be a graph with V vertices that is 2cell embedded on a (possibly nonorientable)
surface of genus g, and with nonnegative weights on the edges, representing
edgelengths. We further assume that the embedding does not have faces consisting of one or
two edges. Our main contributions are the following:
• We find a shortest surface nonseparating cycle of G in O(g3/2V 3/2 log V +
g5/2V 1/2) time. This result relies on a characterization of the surface nonseparating
cycles given in Section 4. The algorithmical implications of this characterization
are described in Section 5.
• We find a shortest noncontractible cycle in O(gO(g)V 3/2) time. Then g = O(1), the
running time becomes O(V 3/2), which represents an improvement over previous
results. This is achieved by considering a small portion of the universal cover. See
Section 6.
• We compute the nonseparating facewidth and edgewidth of G in O(g3/2V 3/2 +
g5/2V 1/2) time. We can also compute the facewidth and edgewidth of G in
O(gO(g)V 3/2) time. For the nonseparating facewidth, this is a particular case
of the result mentioned above where a log factor can be shaved off. See Section 7.
• For graphs embedded on the projective plane or the torus we can compute the
facewidth in O(V 2 log2 V ) or O(V 5/4 log V ) time, respectively. This is described
in Sections 7.2 and 7.3.
Although the general approach is common in all our results, the details are quite
different for each case. The overview of the technique is as follows. We find a set
of generators either for the first homology group (in the nonseparating case) or the
fundamental group (in the noncontractible case) that is made of a few shortest paths.
It is then possible to show that the shortest cycles we are interested in (nonseparating
or noncontractible ones) intersect these generators according to certain patterns, and
this allows us to reduce the problem to computing distances between pairs of vertices in
associated graphs.
The paper is organized as follows. The remainder of this section describes the most
relevant related work, and in Section 2 we introduce the basic background. In Section 3
we describe basic tools that are used through the paper. The rest of the sections are as
described above; we conclude in Section 8.
1.2. Related Previous Work
Thomassen [
23
] was the first to give a polynomialtime algorithm for finding a shortest
nonseparating and a shortest noncontractible cycle in a graph on a surface; see also
Chapter 4 of [
20
]. Although Thomassen does not claim any specific running time, his
algorithm tries a quadratic number of cycles, and for each one it has to decide if it is
nonseparating or noncontractible. This yields a rough estimate O(V (V + g)2) for its
running time. More generally, his algorithm can be used for computing in polynomial
time a shortest cycle in any class C of cycles that satisfy the socalled 3pathcondition:
if u, v are vertices of G and P1, P2, P3 are internally disjoint paths joining u and v, and
if two of the three cycles Ci, j = Pi ∪ Pj (i = j ) are not in C, then the third one is also
not in C. The class of onesided cycles for embedded graphs is another relevant family
of cycles that satisfy the 3pathcondition.
Erickson and HarPeled [
10
] considered the problem of computing a cutset of
minimum length, that is, a subgraph C ⊆ G of minimum length such that \C is a
topological disk. They show that the problem is NPhard when the genus is not fixed, provide
a polynomialtime algorithm for fixed surfaces, and provide efficient approximation
algorithms.
More relevant for our work, Erickson and HarPeled [
10
] also give the currently best
algorithms for the problems we consider: they find a shortest noncontractible cycle in
O(V 2 log V + V g) time, and a shortest nonseparating cycle in O(V 2 log V + V g log g)
time. Regarding the edgewidth or the facewidth, we are not aware of any specific
research to compute them, and therefore these general algorithms were also the
asymptotically fastest for these problems. Their approach is based on showing that a shortest
noncontractible (resp. nonseparating) loop through a fixed vertex can be computed
in O(V log V + g) (resp. O(V log V + g log g)) time, and then iterate this procedure
over all vertices of the graph. Erickson and HarPeled also provide an algorithm that in
O(g(V + g) log V ) time finds a nonseparating (or noncontractible) cycle whose length
is at most twice the length of a shortest one.
Several other algorithmical problems for graphs embedded on surfaces have been
considered. Colin de Verdie`re and Lazarus [
5
] considered the problem of finding a
shortest cycle with a fixed base point within a given homotopy class, as well as a system
of loops in a given homotopy class. Under some realistic assumption on the edgelengths,
they provide polynomialtime algorithms for both problems. The same authors have also
studied algorithms for finding optimal pants decompositions [
4
].
Eppstein [
9
] discusses how to use the tree–cotree partition for dynamically
maintaining properties from a graph under several operations. For example, he can maintain the
minimum and maximum spanning tree under edge insertions, edge deletions, and edge
reweightings.
Very recently, Erickson and Whittlesey [
11
] have shown that the greedy homotopy
generators through a fixed basepoint determine a shortest set of loops generating the
fundamental group. They can compute this optimal system of loops and represent it
implicitly in O((V + g) log V ) time; an explicit representation may need (gV ) space.
Other known results for curves embedded on topological surfaces include [
6
], [
7
], [
19
],
and [
24
]; see also [
21
], [
22
], and the references therein.
2. Background
We describe most of the topological and graphtheoretical background that is used
through the paper.
Topology. We consider surfaces that are connected, compact, Hausdorff topological
spaces in which each point has a neighborhood that is homeomorphic to R2. In particular,
we only consider surfaces without boundary. A closed curve is a continuous function of
the circle S1 in . A simple closed curve is an injective closed curve. Two closed curves
are homotopic if there is a continuous deformation of one onto the other, that is, if there
is a continuous function from the cylinder S1 × [
0, 1
] to such that each boundary of
the cylinder is mapped to one of the curves.
A closed curve is contractible if it is homotopic to a constant (a curve whose image is a
single point); otherwise it is noncontractible. A closed curve is (surface) nonseparating
if the removal of its image keeps the surface connected. Another definition of a
nonseparating closed curve is that it is a nontrivial element of the (Z2)homology group.
Although these two definitions can be seen to be equivalent for simple closed curves
(see Lemma 4), they are not equivalent in general, as can be seen by concatenating two
copies of the same nonseparating cycle. Although the first definition is more intuitive,
it has the drawback problem of not being stable under small perturbations of the curves.
However, as we will see later, it turns out that both concepts agree when it comes to
finding a shortest nonseparating closed curve.
If c is a simple closed curve, a small band around c is either a cylinder or a Mo¨bius
band. In the former case, we say that c is twosided, otherwise it is onesided. In an
orientable surface all the closed curves are twosided. We refer to Chapter 1 of [
14
] and
to Chapter 4 of [
20
] for additional details.
Every graph, viewed as a onedimensional cell complex, determines a topological
space and we can speak of embeddings (continuous 1–1 maps) in surfaces. It is customary
to consider only 2cell embeddings, in which every face (i.e., a connected component of
the surface after we remove the image of the graph) is homeomorphic to an open disk.
In this paper we also make such a restriction and, henceforth, every embedding will be
2cell. As shown in Chapter 3 of [
20
], such embeddings admit a simple combinatorial
description whose development is usually attributed to Heffter, Edmonds, and Ringel.
See also a paragraph below.
If G is a graph with V vertices, E edges, and is embedded in a surface with F
faces, then Euler’s formula holds:
V − E + F = 2 − g,
where g is a nonnegative integer, called the (Euler) genus of .
If is orientable, then g¯ = 21 g is also an integer, known as the genus of . Since
we will meet the genus only in the Onotation, there is no need to distinguish between
g and g¯.
Walks in Graphs. In a graph G, a walk is an alternating sequence of vertices and
edges v1e1v2e2 · · · vk ek vk+1, starting and ending with a vertex, and such that each edge
ei connects the vertices vi and vi+1; a path is a walk where all vertices are distinct; a
segment is a subwalk; a loop is a walk where the first and last vertex are the same; a cycle
is a loop without repeated vertices. In a loop the first and last vertex is a distinguished
base vertex. If G is on a surface , the loops and cycles of G correspond to closed
curves and simple closed curves in , respectively, and therefore we can refer to their
topological properties.
In general, we consider graphs with nonnegative edgelengths, that is, we have a
function w: E → R+ describing the length of the edges. The length of a walk is the
sum of the weights of its edges, counted with multiplicity if they occur on the walk more
than once. We also assume that no cycle has length zero.
It is not difficult to see that any shortest noncontractible loop in G must be a
cycle. Indeed, it holds that the concatenation of two contractible loops is a contractible
loop. Therefore, if a loop is noncontractible and it is not a cycle, then it must be the
concatenation of two shorter loops, and it cannot be that both are contractible.
Similarly, any shortest nonseparating loop in G must be a cycle. Indeed, if a loop
is nonseparating and it is not a cycle, then must be the concatenation of two loops
, . However, the image of or is a subset of the image of , and therefore they
cannot disconnect the surface.
Cutset, System of Cycles, and Universal Cover. In G a cutset is a set of edges whose
complement is a topological disk. We reserve the term system of cycles for a set of cycles
in G through a common vertex x , and pairwise disjoint otherwise, whose edges form
a cutset. It is known that a system of cycles consists of exactly g cycles. Note that, in
general, a system of cycles does not need to exist in G, since it requires vertices with
high degrees. However, after a suitable transformation in the graph, we may assume its
existence.
Let D be the topological disk obtained from a cutset. Several (possibly an infinite
number of) copies of D can be glued together to obtain a socalled covering space X ,
which locally looks like . In this case the projection π : X → that sends each point
of X to its original point in D is locally a homeomorphism. When X has the property that
it does not contain any noncontractible cycle, then X is the socalled universal cover,
which can be shown to be unique up to homeomorphism. It is known that the universal
cover of the projective plane or the sphere is the sphere, while the universal cover of any
other surface is the plane. Since the surface and its universal cover U look locally the
same, any curve c in can be routed locally in the same way in U , giving the socalled
lift c˜ of c in U . It turns out that a closed curve in is contractible if and only if its
lift finishes at the same point where it starts. See Chapter 1 of [
14
] for a comprehensive
treatment of covering spaces.
Representation of Embedded Graphs. For computational purposes, an embedded graph
can be represented as described by Eppstein [
9
]. However, for our purposes, the Heffter–
Edmonds–Ringel representation is used. It is enough to specify for each vertex v the
circular ordering of the edges emanating from v, where the ordering coincides with that
on the surface in a small disk neighborhood of v. Additionally we need the signature
λ(e) ∈ {+1, −1} for each edge e ∈ E (G). The negative signature of e tells us that
the selected circular ordering around vertices changes from clockwise to anticlockwise
when passing from one end of the edge to the other. If the embedding is in an orientable
surface, all the signatures can be made positive, and there is no need to specify them.
A cycle in the embedding is twosided if the product of the signatures of its edges is
positive; otherwise, it is a onesided cycle. It is known that this representation uniquely
determines the embedding of G, up to homeomorphism. Knowing the circular ordering
at each vertex and the signatures, one can compute the set of facial walks in linear time.
See Chapter 3 of [
20
] if more detail is needed.
In an embedded graph, a 1gon is a face defined by a single edge of the graph, and a
2gon is a face defined by two (parallel) edges. For the problems that we consider, any
edge defining a 1gon is not relevant, since it cannot appear in a shortest noncontractible
or nonseparating cycle. The same applies to the longest edge of a 2gon. Since a simple
preprocessing taking O(E ) time allows us to obtain an embedding without 1 or 2gons,
we assume, henceforth, that the graph is embedded without 1 or 2gons.
We use V to denote the number of vertices in G, and g for the (Euler) genus of
the surface . That the graph G has (V + g) edges follows from Euler’s formula
and the fact that the number of faces is at most 2 E . Asymptotically, we may consider
3
V + g as the measure of the size of the input. Observe that this is different from the
approach followed by some authors, where n = V + E is used for the size of the
graph.
We use the notation G C for the graph obtained by cutting the embedded graph G
along a cycle C . Each vertex v ∈ C gives rise to two vertices v , v in G C . If C is a
twosided cycle, then it gives rise to two cycles C and C in G C whose vertices are
{v  v ∈ V (C )} and {v  v ∈ V (C )}, respectively. If C is onesided, then it gives
rise to a cycle C in G C whose length is twice the length of C , in which each vertex
v of C corresponds to two diagonally opposite vertices v , v on C . Observe that if G
is embedded in a surface of Euler genus g, then G C is naturally embedded in the
surface obtained after cutting along C and then pasting disks to each of the boundaries
that were created. Therefore, G C is embedded in a surface of Euler genus g − 1 (if
C is a onesided curve in ) or g − 2 (if C is twosided). When C = {C1, . . . , Ct ) is
a system of cycles, we use G C to denote the graph obtained by cutting G along the
cycles C1, . . . , Ct , in this order, and without pasting disks. Note that for i ≥ 2, the cycle
Ci may be a path connecting two vertices of the boundary of G {C1, . . . , Ci−1}. If C is
a system of cycles, then G C is a planar graph.
Distances in Embedded Graphs. For two vertices u, v ∈ V (G), the distance in G,
denoted dG (u, v), is the minimum length of a path in G from u to v. A shortestpath
tree from a vertex v is a tree T such that for any vertex u we have dG (v, u) = dT (v, u).
Since E = O(V + g), a shortestpath tree from any given vertex can be computed
in O(V log V + E ) = O(V log V + g) time using Fibonacci heaps [
13
]. When g =
O(V 1−ε) for any positive, fixed ε, then a shortest path tree can be constructed in O(V )
time.1
In the special case that all the edgelengths are equal to one, any breadthfirstsearch
tree is a shortestpath tree from the starting vertex, and can be computed in O(V + g)
time.
Width of Embeddings. The edgewidth ew(G) (resp. nonseparating edgewidth
ew0(G)) of a graph G embedded in a surface is defined as the minimum number of
vertices in a noncontractible (resp. surface nonseparating) cycle. The facewidth fw(G)
(resp. nonseparating facewidth fw0(G)) is the minimum number of faces (without
multiplicity) that any noncontractible (surface nonseparating) closed curve in the surface
is going to intersect.
Algorithmically, the following characterization of facewidth is more suitable. For
an embedded graph G, consider its vertex–face incidence graph : a bipartite graph,
naturally embedded on the surface, whose vertices are faces and vertices of G, and there
is an edge between face f and vertex v if and only if v is on the face f . (If v and
f have multiple incidence, then also has multiple edges joining v and f .) It is not
difficult to see that fw(G) = 21 ew( ) and fw0(G) = 2
1 ew0( ) [20, page 148]. Since the
construction of takes linear time from an embedding of G, this reduces the problem
of computing the facewidth of G to that of computing the edgewidth of .
Model of Computation. We assume nonnegative real edgelengths, and our algorithms
run in the comparisonbased model of computation, that is, we only add and compare
(sums of) edge weights. For integer weights and the wordRAM model of computation,
some logarithmic improvements may be possible. See the survey by Zwick [
25
] for a
discussion.
3. Basic Tools
We first describe some of the topological tools that are used in the paper, and then present
algorithms for computing distances in embedded graphs.
1 Eppstein [
9
] shows how to compute in linear time a separator S of size O( gV ) = O(V 1−ε/2) for G
such that G − S is planar. The recursive subdivision that Henzinger et al. [
15
] require can then be obtained
using the division by Eppstein in the first level and then continue in each planar subpiece using their approach.
3.1. Topological Tools
3PathCondition. Let C be a family of cycles. We say that C satisfies the
3pathcondition if it has the following property: if u, v are vertices of G and P1, P2, P3 are
internally disjoint paths joining u and v, and if the cycle P1 ∪ P2 is in C, then (at least) one
of the cycles P1 ∪ P3 or P2 ∪ P3 is in C. This concept was introduced by Thomassen [
23
]
(see also Section 4.3 of [
20
]), who showed that the family of noncontractible cycles
and the family of nonseparating cycles satisfy the 3pathcondition. For these families,
there are shortest cycles with the following property.
Lemma 1. Let C be a family of cycles satisfying the 3path property, and let P be a
family of pairwise disjoint shortest paths, except, possibly, at common endpoints. Then
there is a shortest cycle in C that contains at most one segment of each P ∈ P.
Proof. Let C ∈ C. For any two vertices u, v ∈ V (C ), let C1[u, v], C2[u, v] be the
two segments of C connecting u, v. For any vertices u, v in a path P, let P[u, v] be
the segment of P between u and v. For a cycle C and a (simple) path P, let s(C, P)
be the number of maximal common segments that C and P have. Define s(C, P) =
maxP∈P s(C, P) and σ (C, P) = s(C, P).
Let C ∈ C be a shortest cycle in C Pth∈aPt lexicographically minimizes the pair (s(C, P),
σ (C, P)). If s(C, P) ≤ 1, then the statement holds. If s(C, P) ≥ 2, then there is
some path P ∈ P such that s(C, P) = s(C, P) ≥ 2. In this case there are vertices
u, v ∈ V (C )∩V ( P) such that P[u, v], C1[u, v], C2[u, v] are internally disjoint. Observe
that the cycles C1 = P ∪ C1[u , v ] and C2 = P ∪ C2[u , v ] are no longer than
C , have strictly fewer maximal common segments with P, have no more maximal
common segments with any other P ∈ P because P are pairwise disjoint (except at
possible common endpoints), and by the 3pathcondition, one of them, say C1, must
be in the family C. However, then we have σ (C1, P) < σ (C, P) while s(C1, P) ≤
s(C, P), arriving at a contradiction with how C was chosen. Therefore, it holds that
s(C, P) ≤ 1.
Tree–Cotree Decomposition. We use the tree–cotree decomposition for embedded
graphs introduced by Eppstein [
9
]. Let T be a spanning tree of G rooted at x ∈ V (G).
For any edge e = uv ∈ E (G)\T , we denote by loop(T , e) the closed walk in G obtained
by following the path in T from x to u, the edge uv, and the path in T from v to x ;
we use cycle(T , e) for the cycle obtained by removing the repeated edges in loop(T , e).
A subset of edges U ⊆ E (G) is a cotree of G if U ∗ = {e∗ ∈ E (G∗)  e ∈ C } is a
spanning tree of the dual graph G∗. A tree–cotree partition of G is a triple (T , U, X ) of
disjoint subsets of E (G) such that T forms a spanning tree of G, U is cotree of G, and
E (G) = T ∪ U ∪ X . As shown by Eppstein, if (T , U, X ) is a tree–cotree partition, then
L(T,U,X) = {loop(T , e)  e ∈ X } consists of g loops, and it is a cutset.
Orientable Double Cover. In Sections 7.1 and 7.2, for a graph G embedded on a
nonorientable surface, we use its orientable double cover DG , constructed as follows: for
each vertex v ∈ V (G) we place two vertices v, v in V (DG ), for each edge uv ∈ E (G) we
place edges uv, u v in E (DG ) if the signature of uv is λ(uv) = +1, and edges uv , u v
in E (DG ) if λ(uv) = −1; and the circular order of edges around vertices u, u ∈ V (DG )
is the same as around u ∈ V (G). Let π : DG → G be the natural projection. If G has
genus g, then DG has genus at most 2g.
There are two properties of the orientable double cover DG that will be used; both
follow from the homotopy lifting property [14, pages 60ff.]. Firstly, if P is a path in DG
between a vertex v and its copy v , then its projection π( P) is a noncontractible loop in G.
Secondly, if C˜ is a noncontractible cycle in DG , its projection π(C ) is a noncontractible
loop in G. Moreover, any noncontractible loop in G comes from the projection of one
of these two types of walks in DG . As a consequence, if G is on the projective plane,
then DG is a planar graph, and only the first type of noncontractible cycles can occur
in G, that is, any noncontractible cycle in G through vertex v corresponds to a path in
DG between v and v .
3.2. kPairs Distance Problem
Consider the kpairs distance problem:
Given a graph G with positive edgeweights and k pairs (s1, t1), . . . , (sk , tk ) of
vertices of G, compute the distances dG (si , ti ) for i = 1, . . . , k.
Djidjev [
8
] and Fakcharoenphol and Rao [
12
] (slightly improved by Klein [
18
] for
nonnegative edgelengths) describe data structures for shortest path queries in planar
graphs. We will need the following special case.
Lemma 2. For a planar graph of order V , the kpairs distance problem can be solved
in
(i) O(V 3/2 + k√V ) time, and in
(ii) O(V log2 V + k√V log2 V ) time.
Furthermore, the shortest path between the closest pair can be found in the same amount
of time.
Proof. For (i), use the data structure by Djidjev [
8
]: after O(V 3/2) time for
preprocessing, a distance query can be answered in O(√V ) time.
For (ii), use the data structure by Fakcharoenphol and Rao [
12
] with the quicker
construction by Klein [
18
]: after O(V log2 V ) preprocessing time, a distance query can
be answered in O(√V log2 V ) time. Once we know the closest pair, the shortest path
between that pair can be found in O(V ) time [
15
].
For surfaces, we have the following result.
Lemma 3. Let G be a graph embedded on a surface of genus g. The kpairs distance
problem can be solved in O(√gV (V log V + g + k)) time, and in O(√gV (V + k)) time
if g = O(V 1−ε) for some ε > 0. Furthermore, the shortest path between the closest pair
can be found in the same amount of time.
Proof. Let (s1, t1), . . . , (sk , tk ) be k pairs of vertices. The general idea is as follows.
We compute first a small vertex set S such that G − S is a planar graph. To compute
the distance between si and ti , it then suffices to take the minimum of the following two
values:
(i) The length of a shortest path between si and ti that passes through at least one
vertex in S, that is,
dGS (si , ti ) = ms∈iSn{dG (si , s) + dG (s, ti )}.
(ii) The length of a shortest path between si and ti that avoids all the vertices in S.
In other words, if si and ti belong to the same (planar) component G j of G − S,
we compute dGj (si , ti ).
j Vj3/2 +
We now move onto the details. For a graph G embedded on a surface of genus g, there
exist a set S ⊂ V (G) of size O(√gV ) such that G − S is planar. It can be computed in
time linear in the size of the graph, that is, O(V + g) time [
9
].
Making a shortest path tree from each vertex s ∈ S, we compute all the values dG (s, v)
for s ∈ S, v ∈ V (G). Each shortest path tree takes O(V log V + g) time in general, and
O(V ) time if g = O(V 1−ε). Therefore, we need O(√gV (V log V + g)) time in total,
or O(√gV V ) if g = O(V 1−ε).
For each pair (si , ti ), we can now compute the value dGS (si , ti ) of item (i) in O(√gV )
time. For all pairs, this amounts to O(k√gV ) time.
For item (ii), let G1, . . . , Gt be the connected components of G − S, let kj be the
number of pairs (si , ti ) that are in component G j and let Vj be the number of vertices
of the graph G j . Because each G j is planar, the values dGj (si , ti ) for the kj pairs in the
component G j can be computed in O(Vj3/2 + kj Vj ) time as shown in Lemma 2. Since
each pair (si , ti ) is in at most one component of G − S, we have kj ≤ k. Therefore,
we can compute the distances dGj (si , ti ) for all pairs using O j (Vj3/2 + kj Vj ) ≤
O √V √V k) time. This completes the proof.
j kj ≤ O(V 3/2 +
4. Separating versus NonSeparating Cycles
In this section we characterize the surface nonseparating cycles using the concept of
crossing; see Fig. 1. For two simple closed curves that cross transversally, the number of
crossings is the cardinality of the intersection of their images. For two arbitrary simple
closed curves, the number of crossings is the minimum number of crossings over all small
perturbations of the curves that make all the intersections transversal. When the simple
curves are cycles in an embedded graph G, any common segment can be perturbed to
two parallel curves that are arbitrarily close, and defer all the crossings to the endpoints
of the common segment. This leads to the following equivalent, combinatorial definition
of number of crossings for cycles C = u0e0 · · · uk ek u0 and C = u0e0 · · · ul el u0 in an
embedded graph G. If C, C do not have any common edge, for each pair of common
vertices ui = u j we count a crossing if the edges ei−1, ei of C and the edges ej−1, ej of
C alternate in the local rotation around ui = u j (where the indices are taken modulo
k + 1 and l + 1, respectively); the number of all crossings is denoted by cr (C, C ). If
C, C are distinct and have a set of edges E in common, then cr (C, C ) is the number of
crossings after contracting G along E . Finally, if C = C , then we define cr (C, C ) = 0
if C is twosided, and cr (C, C ) = 1 if C is onesided.
Consider a tree–cotree decomposition (T , U, X ) of G, and consider the set of cycles
C(T,U,X) = {cycle(T , e)  e ∈ X } = {C1, . . . , Cg}. Note that if C is a surface separating
cycle, then it splits the surface into two components. Thus, every other cycle crosses
C an even number of times. The following result tells that this parity property with the
cycles in C(T,U,X) is enough to characterize the separating cycles.
Lemma 4. A cycle C in G is surface nonseparating if and only if there is some cycle
Ci ∈ C(T,U,X) such that C and Ci cross an odd number of times, that is, cr (C, Ci ) ≡ 1
(mod 2).
Proof. For the proof, we need the concept of (Z2)homology, which we introduce next;
see Chapter 2 of [
14
] for a comprehensive treatment of homology. A set of edges E is
a 1chain; it is a 1cycle if each vertex has even degree in E ; in particular, every cycle
in the graph is a 1cycle, and also the symmetric difference of 1cycles is a 1cycle. The
set of 1cycles with the symmetric difference operation + is an Abelian group, denoted
by C1(G). This group can also be viewed as a vector space over Z2 and is henceforth
called the cycle space of the graph G. If f is a closed walk in G, the edges that appear
an odd number of times in f form a 1cycle. For convenience, we denote the 1cycle
corresponding to f by the same symbol f .
Two 1chains E1, E2 are homologically equivalent if there is a family of facial walks
f1, . . . , ft of the embedded graph G such that E1 + f1 + · · · + ft = E2. Being
homologically equivalent is an equivalence relation compatible with the symmetric difference of
sets. The 1cycles that are homologically equivalent to the empty set, form a subgroup
B1(G) of C1(G). The quotient group H1(G) = C1(G)/B1(G) is called the homology
group of the embedded graph G.
A set L of 1chains generates the homology group if for any cycle C in G, there is a
subset L ⊂ L such that C is homologically equivalent with Ei ∈L Ei . There are sets
of generators consisting of g 1chains. It is known that any set of loops that gives a cutset
generates the homology group H1(G). Since the repeated edges in a loop disappear, we
conclude that the set of cycles C(T,U,X) = {C1, . . . Cg} generates H1(G).
We next argue that a cycle C is separating if and only if it corresponds to the trivial
element of H1(G). Indeed, if C is a separating cycle, then G C has two connected
components. Let I be the set of indices such that fi , i ∈ I , are the faces in one of the
components. Then we have C = i∈I fi , and therefore C is homologically equivalent
to the empty set. Conversely, if C is a trivial element of the homology group, then there
tahree iunndieoxneosfIthsuecfhacthesat fCi, i=∈ Ii,∈iIs fCi ..STihnecreeCfories,aCcyscelpea,riattfeosllofi w,is t∈haIt,thfreobmoufni,diar∈/y oIf.
For the rest of the proof, we use that nonseparating cycles are nontrivial elements of
the homology group.
Let f0, . . . , fr be the 1cycles that correspond to the facial walks. Then f0 = f1 +
· · · + fr and C(T,U,X) ∪ { f1, . . . , fr } is a generating set of C1(G). If Ei is a 1cycle, then
vEailu=e of j∈J Cj + i∈I fi for certain indices I, J . We define crEi (C ) as the modulo 2
j∈J
cr (C, Cj ) +
i∈I
cr (C, fi ) ≡
j∈J
cr (C, Cj ) mod 2.
It is easy to see that crEi : C1(G) → Z2 is a homomorphism. Since cr (C, fi ) = 0 for
every facial walk fi , crEi also determines a homomorphism H1(G) → Z2.
If C is a surface separating cycle, then it corresponds to the trivial element of H1(G), so
every homomorphism maps it to zero. In particular, for every j , cr (C, Cj ) ≡ crCj (C ) ≡ 0
(mod 2).
Let C be a nonseparating cycle and consider G˜ = G C . Take a vertex v ∈ C , which
gives rise to two vertices v , v ∈ V (G˜ ). Since C is nonseparating, there is a simple
path P in G˜ connecting v , v . The path P is a loop in G (not necessarily a cycle), but
it contains a cycle C that crosses C exactly once.
Since C(T,U,X) generates the homology group, there is a subset C ⊂ C(T,U,X) such that
the cycle C and Ci ∈C Ci are homologically equivalent. However, then 1 ≡ crC (C ) ≡
Ci ∈C cr (C, Ci ) (mod 2), which means that for some Ci ∈ C , it holds that cr (C, Ci ) ≡
1 (mod 2).
5. Shortest NonSeparating Cycle
Let Tx be a shortestpath tree from vertex x ∈ V (G). Let us fix any tree–cotree partition
(Tx , Ux , X x ), and let Cx = {cycle(Tx , e)  e ∈ X x }. For a cycle C ∈ Cx , let Odd(C ) be
the set of cycles that cross C an odd number of times. It follows from Lemma 4 that
C∈Cx Odd(C ) is precisely the set of nonseparating cycles. We will compute a shortest
cycle in Odd(C ), for each C ∈ Cx , and take the shortest cycle among all them; this will
be a shortest nonseparating cycle.
We next show how to compute a shortest cycle in Odd(C ) for C ∈ Cx . Firstly, we
use that Tx is a shortestpath tree to argue that we only need to consider cycles that
intersect C exactly once; a similar idea is used by Erickson and HarPeled [
10
] for their
2approximation algorithm. Secondly, we reduce the problem of finding a shortest cycle
in Odd(C ) to an O(V )pairs distance problem.
Lemma 5. Among the shortest cycles in Odd(C ), where C ∈ Cx , there is one that
crosses C exactly once.
Proof. Let P, P be the two shortest paths that, together with an edge, define C . The
family of cycles Odd(C ) satisfies the 3pathcondition, and the paths P, P are disjoint,
except at x . Therefore, from Lemma 1 we conclude that there is a shortest cycle C0 in
Odd(C ) that contains at most one segment of P, and one segment of P . It follows that
C and C0 can cross at most twice, and since C0 ∈ Odd(C ), they must cross exactly
once.
Lemma 6. For any C ∈ Cx , we can compute a shortest cycle in Odd(C ) in
O((V log V + g)√gV ) time, or O(V √gV ) time if g = O(V 1−ε).
Proof. Consider the graph G˜ = G C . Each vertex v on C gives rise to two copies
v , v of v in G˜ . In G a cycle that crosses C exactly once (at vertex v, say) gives rise to
a path in G˜ from v to v (and vice versa). Therefore, finding a shortest cycle in Odd(C )
is equivalent to finding a shortest path in G˜ between pairs of the form (v , v ) with v
on C . In G˜ , we have O(V ) pairs (v , v ) with v on C , and using Lemma 3 we can find
the shortest path connecting a closest pair (v0, v0 ) in O((V log V + g)√gV ) time, or
O(V √gV ) if g = O(V 1−ε).
Theorem 7. Let G be a graph with V vertices 2cell embedded on a surface of
gbzs g, without 1 or 2gons. We can find a shortest surface nonseparating cycle in
O(g3/2V 3/2 log V + g5/2V 1/2) time, or O((gV )3/2) time if g = O(V 1−ε).
Proof. Since C∈Cx Odd(C ) is precisely the set of nonseparating cycles, we find a
shortest nonseparating cycle by using the previous lemma for each C ∈ Cx , and taking
the shortest among them. The running time follows because Cx contains O(g) loops.
Observe that the algorithm by Erickson and HarPeled [
10
] outperforms our result for
g = (V 1/3 log2/3 V ). Therefore, we can recap concluding that a shortest nonseparating
cycle can be computed in O(min{(gV )3/2, V (V + g) log V }) time.
6. Shortest NonContractible Cycle
Like in the previous section, we consider a shortestpath tree Tx from vertex x ∈ V (G),
and we fix a tree–cotree partition (Tx , Ux , X x ). Consider the cutset given by the loops
L x = {loop(Tx , e)  e ∈ X x }. By increasing the number of vertices to O(gV ), we can
assume that L x becomes a system of cycles (instead of loops) whose pairwise intersection
is x . This can be shown by slightly modifying G in such a way that L x can be transformed
without harm; we give the precise modification in the proof of the following result.
Lemma 8. The problem is reduced to finding a shortest noncontractible cycle in an
embedded graph G˜ of O(gV ) vertices with a given system of cycles Cx such that each
cycle from Cx consists of two shortest paths from x plus an edge. This reduction can be
done in O(gV ) time.
Proof. Throughout this proof we assume that the given embedding is represented in
such a way that signatures of edges in Tx are all positive. For vertices u, u ∈ V (G),
vk+1
we use P[u, u ] for the (unique) path in Tx from u to u . For a loop l ∈ L x , we define
split(l) as the vertex v on l such that the part that appears twice in l is equal to P[x , v].
In particular, split(l) = x if and only if l is a cycle.
Our first goal is to change the graph G and the spanning tree Tx in such a way that
the loops in L x will all become cycles whose pairwise intersection is only the vertex x .
To achieve this goal, we proceed as follows.
There is nothing to do if all loops in Tx are cycles. Otherwise, consider a loop l0
in L x that is not a cycle and whose repeated part P0 = P[x , split(l0)] is shortest. Let
x = v0, v1, . . . , vk = split(l0) be the consecutive vertices on P0. Let vk+1 and vk+1 be
the neighbors of vk that are on the loop l0 and are distinct from vk−1. Assume, moreover,
that the edges of l0 around vk have local rotation vk−1, vk+1, vk+1 (in clockwise order
on Fig. 2). The edges incident with each vertex vi (1 ≤ i ≤ k) that are not on the
path v0, v1, . . . , vk+1 can be classified as those on the left or on the right of that path.
Now we replace the path x , v1, . . . , vk in G with two paths P0 = x , v1, . . . , vk and
P0 = x , v1 , . . . , vk , and add the edges vi vi (1 ≤ i ≤ k) between them. All edges
incident with vi that are on the right of vi in G are now incident with vi , while the rest
are incident with vi , i = 1, . . . , k. In particular, the edge vk vk+1 which is on the right
of vk , is replaced by the edge vk vk+1, while the edge vk vk+1 is replaced by vk vk+1. See
Fig. 2. The edges that correspond to previous edges have the same length in the new
graph, while all new edges vi vi have length 0.
The new graph is naturally embedded in as well. We replace the loop l0 in L x by the
cycle P0, l0\ P[v0, vk ], P0. The rest of loops (or cycles) in L x remain the same except that
their segment common with P0 is replaced with the corresponding new segments. They
keep being loops (or cycles) because we have chosen l0 such that length( P[x , split(l0)])
is shortest among nonsimple loops in Tx .
We repeat the procedure until L x consists of only cycles; we need O(g) repetitions.
Each cycle in L x may have two paths from x in common with other cycles. Consider a
longest path P that two cycles C, C ∈ L x have in common. Using the same technique
as above, we can modify the graph and the cycles C, C in such a way that they share one
path less; details are similar and omitted. We keep repeating this step until any pair of
cycles intersects only at x . We have to repeat this step at most 2L x  = 2g times because,
at each step, a new edge adjacent to x that is used by some cycle is created. Therefore,
the cycles in the resulting set pairwise intersect only in vertex x .
Let G˜ be the final graph that is obtained and let L˜ x be the final set of cycles. Observe
that each cycle in L˜ x is composed of two shortest paths from x plus an edge. It is clear that
a shortest noncontractible cycle in G˜ corresponds to a shortest noncontractible cycle
in the original graph G, as well as shortest paths in G˜ correspond to shortest paths in G.
The problem reduces then to finding a shortest noncontractible cycle in G˜ . However,
observe that the number of vertices has increased; each step may add O(V ) vertices, and
therefore G˜ consists of O(gV ) vertices. This reduction can easily be done in O(gV )
time.
The problem that remains is to find a shortest noncontractible cycle in a new graph
G˜ with O(gV ) vertices where we are given a system of cycles Cx . Moreover, each cycle
of Cx consists of two shortest paths from x plus an edge. Let C∗ be the set of shortest
noncontractible cycles in G˜ . Using Lemma 1, we obtain the following property.
Lemma 9. Among the cycles in C∗, there is one that crosses each cycle in Cx at most
twice.
Proof. Consider the 2g shortest paths P that define the cycles in Cx . They are pairwise
disjoint, except at x . Since the set of shortest noncontractible cycles satisfies the
3pathcondition, Lemma 1 implies that there is a shortest noncontractible cycle C0 ∈ C∗ that
contains at most one segment from each P ∈ P. It follows that each cycle C ∈ Cx can
be crossed at most twice by C0.
Since Cx is a system of cycles, the set D = Cx is a topological disk, and the
corresponding graph G D = G˜ Cx is planar. In G D each cycle from Cx corresponds
to two paths on the boundary of D. We can glue an infinite number of copies of D to
construct the universal cover of . However, because of Lemma 9, we can find a shortest
noncontractible cycle by constructing only a portion of this universal cover. These are
the main ideas to prove the following result.
Theorem 10. Let G be a graph with V vertices 2cell embedded on a surface of genus
g, without 1 or 2gons. We can find a shortest noncontractible cycle in O(gO(g)V 3/2)
time.
Proof. According to Lemma 8, we assume that G˜ has O(gV ) vertices and we are given
a system of cycles Cx such that each cycle of Cx consists of two shortest paths plus an
edge. Moreover, because of Lemma 9, there is a shortest noncontractible cycle crossing
each cycle of Cx at most twice.
Consider the topological disk D = Cx and the planar graph G D = G˜ Cx . Let
U be the universal cover that is obtained by gluing copies of D along the cycles in Cx ,
and let GU be the graph that is obtained by gluing copies of G D according to the same
pattern. The graph GU is naturally embedded in U , and it is an infinite planar graph,
unless is the projective plane P2, in which case GU is finite.
Let us fix a copy D0 of D, and let U0 be the portion of the universal cover U which
is reachable from D0 by visiting at most 2g different copies of D. Since each copy
of D is adjacent to 2Cx  = 2g copies of D, U0 consists of (2g)2g = gO(g) copies
of D. The portion GU0 of the graph GU that is contained in U0 can be constructed in
O(gO(g)gV ) = O(gO(g)V ) time. We assign to the edges in GU0 the same weights they
have in G.
A cycle is noncontractible if and only if its lift in U finishes in different copies of
the same vertex. Each time that we pass from a copy of D to another copy we must
intersect a cycle in Cx . Using the previous lemma, we conclude that there is a shortest
noncontractible cycle whose lift intersects at most 2Cx  = O(g) copies of D. That is,
there exists a shortest noncontractible cycle in G whose lifting to U starts in D0 and is
contained in GU0 .
We can then find a shortest noncontractible cycle by computing, for each vertex
v ∈ D0, the distance in GU0 from the vertex v to all the other copies of v that are
in GU0 . Each vertex v ∈ D0 has O(gO(g)) copies in GU0 . Therefore, the problem
reduces to computing the shortest distance in GU0 between O(gO(g)V ) pairs of
vertices. Since GU0 is a planar graph with O(gO(g)V ) vertices, the result follows from
Lemma 2(i).
Observe that, for a fixed surface, the genus is constant and the running time of the
algorithm is O(V 3/2). However, for most values of g as a function of V (when g ≥
clog V /log log V for a certain constant c), the nearquadratic time algorithm by Erickson
and HarPeled [
10
] is better.
7. EdgeWidth and FaceWidth
When edgelengths are all equal to 1, shortest noncontractible and surface
nonseparating cycles determine combinatorial width parameters (see Chapter 5 of [
20
]). Since their
computation is of considerable interest in topological graph theory, it makes sense to
consider this special case in more details.
7.1. Arbitrary Embedded Graphs
Recall the parameters measuring the width of embedded graphs that were introduced
in Section 2. The (nonseparating) edgewidth ew(G) (ew0(G), respectively) of an
embedded graph G is the minimum number of vertices in a noncontractible (surface
nonseparating) cycle. Therefore, the nonseparating edgewidth can be computed by setting
w(e) = 1 for all edges e in G and running the algorithms from previous sections. The
(nonseparating) facewidth fw(G) (fw0(G), respectively) of an embedded graph G
is one half of the (nonseparating) edgewidth of its vertex–face incidence graph : a
bipartite graph whose vertices are faces and vertices of G, and there is an edge between
face f and vertex v if and only if v is on the face f .
Observe that, for this special case, a breadthfirstsearch tree is indeed a shortestpath
tree, and it can be computed in O(V + g) time, instead of O(V log V + g) that is required
for arbitrary lengths if the genus is high. This improves slightly the running time for this
special case.
Theorem 11. Let G be a graph with V vertices 2cell embedded on a surface of genus
g, without 1 or 2gons. Its nonseparating edgewidth and facewidth can be computed
in O(g3/2V 3/2 + g5/2V 1/2) time. Its edgewidth and facewidth can be computed in
O(gO(g)V 3/2) time.
It can happen that ew(G) = (V ). The situation is different for the facewidth
fw(G) for which there exist nontrivial bounds. The key tool is the following result by
Hutchinson [
16
], which improves a previous bound by Albertson and Hutchinson [
1
].
Theorem 12 [
16
]. Let T be a triangulation in an orientable surface of genus g. Then
ew(T ) = O(√V /g log g) if g ≤ V , and ew(T ) = O(log g) if g > V .
We now extend this result to nonorientable surfaces, and then provide a bound on
the facewidth of graphs.
Lemma 13. Let T be a triangulation in an arbitrary surface of genus g. Then ew(T ) =
O(√V /g log g) if g ≤ V , and ew(T ) = O(log g) if g > V .
Proof. If T is orientable, then the previous theorem suffices. For nonorientable surfaces
we form its orientable double cover DT , as explained in Section 3. DT is also a
triangulation and has genus g˜ ≤ 2g. By Theorem 12, DT contains a noncontractible cycle C˜
of length O( 2V /g˜ log g˜) = O(√V /g log g) if g˜ ≤ 2V , and O(log g˜) = O(log g) if
g˜ > 2V . The projection C of C˜ to T is a closed walk in T which is noncontractible.
This walk contains a noncontractible cycle of length at most V (C˜ ) = ew(DT ), so
ew(T ) ≤ ew(DT ). Since g˜ ≤ 2g, the bound also follows for the nonorientable case.
Theorem 14. Let G be a graph of order V embedded in a surface of genus g. Then
fw(G) = O(√V /g log g) if g ≤ V , and fw(G) = O(log g) if g > V .
Proof. Consider the vertex–face incidence graph , which has a natural embedding as
a quadrangulation in the same surface as G, that is, all facial walks consist of exactly
four edges. Let T = + E (G) be the triangulation obtained from by adding all edges
1 ew( ) ≤ ew(T ).
of G in the quadrangular faces of . Then fw(G) = 2
From the previous lemma, we have ew(T ) = O(√V (T )/g log g) if g ≤ V (T ),
and O(log g) if g > V (T ). Since V (T ) = V + F (G) = O(V + g), the first bound
reduces to ew(T ) = O(√V /g log g). This completes the proof.
7.2. FaceWidth in the Projective Plane
For the special case when G is embedded in the projective plane P2, we can improve the
running time for computing the facewidth. The idea is to use an algorithm for computing
the edgewidth whose running time depends on the value ew(G). This is achieved by
combining three ideas: an algorithm of Erickson and HarPeled [
10
] to compute a
noncontractible cycle which is at most twice as long as a shortest noncontractible cycle;
a double cover of G which is planar; and Lemma 2(ii) for distance queries on planar
graphs. The result is as follows.
Lemma 15. If G is embedded in P2 and ew(G) ≤ t , then we can compute ew(G) and
find a shortest noncontractible cycle in O(V log2 V + t √V log2 V ) time.
Proof. Consider the orientable double cover DG of G, as explained in Section 3. DG
is a planar graph, and each vertex v of G gives rise to two vertices v, v . Moreover,
any shortest noncontractible loop passing through a vertex v ∈ V (G) is equivalent to a
shortest path in DG between the vertices v and v .
We can compute in O(V log V ) time a noncontractible cycle C of G of length at most
2ew(G) ≤ 2t using the results of [
10
]. Actually, this can be done in O(V ) time by using
a breadthfirstsearch tree. Any noncontractible cycle in G has to intersect C at some
vertex. In particular, every shortest noncontractible cycle intersects C . Consider in DG
the C  ≤ 2t pairs of vertices = {(v, v )  v ∈ V (C )}, and let P be a shortest path in
DG between a closest pair of . The path P can be found in O(V log2 V + t √V log2 V )
time using Lemma 2, and it corresponds to a shortest noncontractible cycle in G.
Like before, consider the vertex–face incidence graph which can be constructed
in linear time. We have ew( ) = 2fw(G), and from Theorem 14 we obtain ew( ) =
O(√V ). Therefore, the problem reduces to that of computing the edgewidth of a graph
knowing a priori that ew( ) = 2fw(G) = O(√V ). Using the previous lemma with
t = O(√V ), we conclude the following.
Theorem 16. Let G be a graph with V vertices 2cell embedded in P2, without 1 or
2gons. We can compute its facewidth in O(V log2 V ) time.
Juvan and Mohar [
17
] obtained a lineartime algorithm for deciding if fw(G) ≤ k,
where k is a fixed constant. They needed the special case when k = 4 in an algorithm
for testing embeddability in the torus.
7.3. FaceWidth in the Torus
We next describe an algorithm for computing the facewidth for a graph G embedded
on the torus T. Consider the vertex–face incidence graph ; we will compute ew( ) =
2fw(G). Observe that on a fixed surface, V ( ) = (V ).
We compute in O(V log V ) time a noncontractible cycle C of of length at most
2ew( ) = fw(G) using the results of [
10
]. We know that C  = O(√V ) by Theorem 14.
See also Lemma 17 below.
Fix a vertex v0 ∈ C and find in O(V log V ) time a shortest noncontractible loop l from
v0. Let A be the noncontractible cycle obtained by removing the repeated edges from
l. We know that A consists of two shortest paths from a vertex u0 ∈ V ( ) plus an edge;
u0 = v0 if l was a cycle, and u0 = v0 otherwise. Moreover,  A ≤ l ≤ C  = O(√V ).
theTOhe( √grVap)hpaiArs= =A{i(svp,lavna)r. Lvet∈v ,Vv( Ab)e} tahnedtwfiondcoapipeasirof(vv1,∈v1A)in∈ A. sCuocnhsitdheart
d A (v1, v1 ) = min{d A (v , v )  (v , v ) ∈ } in O(V log2 V ) time using Lemma 2. Let
Pv1 be a shortest path in A from v1 to v1 , which is a noncontractible cycle B in . The
graph B = B is planar as well.
We may assume that
B ≥
√2
2  A.
(1)
If not, then we repeat the above procedure by starting with B playing the role of the
cycle C . Then we find new cycles A and B. If (1) is violated again, then the length of
the new cycle B would be strictly smaller than onehalf of the length of the former cycle
A. This would imply that B < ew( ), a contradiction.
Using Menger’s theorem for vertexdisjoint paths, we can prove the following bound.
Lemma 17. It holds that  A · B = O(V ).
Proof. Let M be the maximum number of vertexdisjoint paths from A to A , the copies
of A in A. By Menger’s theorem, M is equal to the cardinality of a minimum ( A , A
)separator S in γA. Since A is embedded in a cylinder with A and A being the cycles
on the boundary, the separator S gives rise to a closed curve γ in the torus homotopic to
A that intersects precisely in the vertices in S. Since is a quadrangulation, the curve
γ determines a noncontractible cycle C in of length at most 2S = 2M . In particular,
M ≥ 12 ew( ) ≥ 41  A.
Let R1, . . . , RM be disjoint ( A , A )paths. Each Ri together with a segment on A
determines a path from a vertex v ∈ V ( A ) to its mate v in A of length at most
Ri  + 21  A. Consequently, Ri  + 21  A ≥ B. Since R1, . . . , RM are vertex disjoint and
(1) holds, we get
V ≥
M
i=1
Ri  ≥ M (B − 21  A) ≥ 41  A 1 −
B.
√2
2
This completes the proof. Cycles A and B constructed above can be used for a fast computation of the facewidth of G.
Theorem 18. Let G be a graph with V vertices 2cell embedded in the torus, without
1 or 2gons. We can compute its facewidth in O(V 5/4 log V ) time.
Proof. Every noncontractible cycle in the torus is surface nonseparating. Since the
cycles A, B are a cutset, the proof of Lemma 4 tells us that we can assume that a shortest
noncontractible cycle crosses either A or B an odd number of times.
We first assume that a shortest noncontractible cycle crosses A an odd number of
times. Since A is composed of two shortest paths (plus an edge), the argument used in
the proof of Lemma 5 shows that there is a shortest noncontractible cycle that crosses
A exactly once. In this case, B is a shortest noncontractible cycle, and we are done.
We now consider the case where every shortest noncontractible cycle crosses B an
odd number of times. The argument used in Lemma 5 shows that we can assume that a
shortest noncontractible cycle crosses A at most twice and, therefore, it crosses A twice
or not at all. Let C be one such shortest noncontractible cycle crossing B a minimum
number of times and A twice or not at all. Then C crosses B exactly once. To see this,
consider the crossings C has with A and B as you walk along C . A segment s of C
between two crossings of C with B must contain a crossing of C with A, as otherwise
s is contained in a copy of A and it could be replaced by a homotopic segment of
B to reduce the number of crossings with B. Since between two crossings of C with B
there must be a crossing of C with A, then C and B can cross at most twice. However,
we were assuming that C crosses B an odd number of times, and we conclude that they
cross exactly once.
We distinguish two cases depending on the length of A:
• If  A ≥ V 1/4 log V , then B = O(V 3/4/log V ) because of Lemma 17. We
compute the distance from v to v for any v ∈ B as follows. Consider the graph B =
B, that is planar, and the B = O(V 3/4/log V ) pairs = {(v , v )  v ∈ B}.
We can then use Lemma 2 with B and to find in O(V 5/4 log V ) time a shortest
path between the closest pair of , which corresponds to a shortest noncontractible
cycle in .
• If  A < V 1/4 log V , consider the topological disk D = T\( A ∪ B), make its
copy D0, and construct the portion U0 of the universal cover reachable from D0
by crossing A at most twice and without crossing B. This needs five copies of D;
see Fig. 3. Let 0 be the cover of naturally embedded in U0 by gluing copies
of D.
A
BFS(Γ0, v1, ∗)
v0 v1 B
D0
B
vB
A
Copies vi of vertices in B
Fig. 3. Portion of the universal cover reachable by crossing A at most twice and B not at all. We show some
of the concepts used in the proof.
u
D0
v
v
A
A
Fig. 4. A path of length l in 0 yields a path of length at most l + 2A in D0.
In D0, let v1, v2, . . . , vB be the consecutive vertices of one copy of B. The
shortest cycle we are seeking corresponds to a shortest path connecting vi with
some copy vi of vi .
We make for each vi a BFS( 0, vi ,  A − 1), where BFS( 0, u, t ) is a
breadthfirstsearch tree from vertex u in the graph 0 clipped at depth t , that is, only
including vertices up to depth t . If a shortest noncontractible cycle has length
strictly smaller than  A, then its lift in 0 has to be contained in BFS( 0, vi ,  A−1)
for some vi ∈ B. Therefore, once we have BFS( 0, vi ,  A − 1) for all vi ∈ B we
can easily find a shortest noncontractible cycle.
We claim that it takes O(V 5/4 log V ) time to construct the trees BFS( 0, vi ,  A−
1) for all i = 1, . . . , B. Observe that the proof of the claim will finish the proof
of the theorem. The proof is as follows. Define the sets Bk = {vk+4iA  i =
0, . . . , B/4 A } for k = 1, . . . , 4 A; that is, Bk consists of vk and each 4 Ath
vertex along B. Observe that B\ k Bk = {vB−(B mod 4A), . . . , vB−1} consists
of O( A) = O(V 1/4 log V ) vertices. Therefore, the trees BFS( 0, u,  A − 1) for
u ∈ B\ k Bk can be computed in O(V 1/4 log V ) · O(V ) = O(V 5/4 log V ) time.
If u , v ∈ Bk , then d A(u , v ) ≥ 4 A because B is a shortest path in A.
This implies that d 0 (u , v ) ≥ 2 A because any shortest path of length l in 0 can
be clipped by D0 to obtain a path of length at most l + 2 A; see Fig. 4. Therefore,
if u , v ∈ Bk , we have BFS( 0, u , A
  − 1) ∩ BFS( 0, v ,  A − 1) = ∅. Since for
any fixed k, each edge of 0 appears at most once in the trees {BFS( 0, u,  A−1) 
u ∈ Bk }, we can compute BFS( 0, u,  A − 1) for all u ∈ Bk in O(V ) time. The
parameter k takes the values 1, . . . , 4 A = O(V 1/4 log V ), and therefore we need
O(V 1/4 log V ) · O(V ) = O(V 5/4 log V ) time to compute BFS( 0, u,  A − 1) for
all u ∈ k Bk . This finishes the proof of the claim and of the theorem.
8. Conclusions
We have presented algorithms for finding shortest noncontractible and surface
nonseparating cycles for graphs embedded on a surface. For a fixed surface, our
algorithms run in O (V 3/2) time, which is a considerable improvement over previous
results. Our algorithms can be used to compute the (nonseparating) edgewidth and the
(nonseparating) facewidth of embedded graphs.
Our algorithms work for undirected graphs with nonnegative edgelengths. Similar
results for directed graphs seem much harder because noncontractible or nonseparating
cycles do not satisfy the 3pathcondition anymore. Finding shortest cycles with
properties that do not satisfy the 3pathcondition remains an elusive problem.
We have also given a nearlinear running time algorithm for computing the
facewidth in the projective plane; for the torus, we show how to compute the facewidth in
O (V 5/4 log V ) time. We feel that one of the most appealing open questions is finding
nearlinear running time algorithms for computing the facewidth of graphs embedded
on a (possibly fixed) surface. Our approach when dealing with the projective plane and
the torus does not seem to extend to surfaces of higher genera.
Acknowledgments References
The authors thank an anonymous referee for several valuable suggestions.
1. M. O. Albertson and J. P. Hutchinson . On the independence ratio of a graph . J. Graph Theory , 2 : 1  8 , 1978 .
2. S. Cabello and B. Mohar . Finding shortest nonseparating and noncontractible cycles for topologically embedded graphs . In G. S. Brodal and S. Leonardi, editors, ESA '05 , volume 3669 of LNCS , pages 131  142 . Springer, Berlin, 2005 .
3. E ´ . Colin de Verdie`re. Shortening of curves and decomposition of surfaces . Ph.D. thesis , Universite´ Paris 7, December 2003 . Available at http://www.di.ens.fr/users/colin/textes/these.html.en.
4. E ´ . Colin de Verdie`re and F. Lazarus . Optimal pants decompositions and shortest homotopic cycles on an orientable surface . In Proc. 11th Int. Symp. Graph Drawing , volume 2912 of LNCS , pages 478  490 . Springer, Berlin, 2004 .
5. E ´ . Colin de Verdie`re and F. Lazarus . Optimal system of loops on an orientable surface . Discrete Comput. Geom. , 33 : 507  534 , 2005 . Preliminary version in FOCS ' 02 .
6. T. K. Dey and S. Guha . Transforming curves on surfaces . J. Comput. System Sci. , 58 : 297  325 , 1999 . Preliminary version in FOCS ' 95 .
7. T. K. Dey and H. Schipper . A new technique to compute polygonal schema for 2manifolds with application to nullhomotopy detection . Discrete Comput. Geom. , 14 : 93  110 , 1995 .
8. H. Djidjev . Efficient algorithms for shortest path problems on planar digraphs . In F. d'Amore, P. G. Franciosa , and A . MarchettiSpaccamela, editors, WG '96 , volume 1197 of LNCS , pages 151  165 . Springer, Berlin, 1997 .
9. D. Eppstein . Dynamic generators of topologically embedded graphs . In Proc. 14th Symp. Discrete Algorithms , pages 599  608 . ACM, New York, and SIAM, Philadelphia, PA, January 2003 .
10. J. Erickson and S. HarPeled . Optimally cutting a surface into a disk . Discrete Comput. Geom. , 31 : 37  59 , 2004 . Preliminary version in SoCG ' 02 .
11. J. Erickson and K. Whittlesey . Greedy optimal homotopy and homology generators . In Proc. 16th Symp. Discrete Algorithms , pages 1038  1046 , 2005 .
12. J. Fakcharoenphol and S. Rao . Planar graphs, negative weight edges, shortest paths, and near linear time . In FOCS 2001 , pages 232  242 , 2001 .
13. M. L. Fredman and R. E. Tarjan . Fibonacci heaps and their uses in improved network optimization algorithms . J. ACM , 34 : 596  615 , 1987 . Preliminary version in FOCS ' 84 .
14. A. Hatcher . Algebraic Topology. Cambridge University Press, Cambridge, 2001 . Available at http://www.math.cornell.edu/∼hatcher/.
15. M. Henzinger , P. Klein , S. Rao , and S. Subramanian . Faster shortestpath algorithms for planar graphs . J. Comput. System Sci. , 55 ( 1 ): 3  23 , 1997 .
16. J. P. Hutchinson . On short noncontractible cycles in embedded graphs . SIAM J. Discrete Math. , 1 : 185  192 , 1988 .
17. M. Juvan and B. Mohar . An algorithm for embedding graphs in the torus . Submitted.
18. P. N. Klein . Multiplesource shortest paths in planar graphs . In Proc. 16th ACMSIAM Symp. Discrete Algebra (SODA) , pages 146  155 , 2005 .
19. F. Lazarus , M. Pocchiola , G. Vegter, and A. Verroust . Computing a canonical polygonal schema of an orientable triangulated surface . In Proc. 17th Symp. Computational Geometry , pages 80  89 , 2001 .
20. B. Mohar and C. Thomassen . Graphs on Surfaces. Johns Hopkins University Press, Baltimore, MD , 2001 .
21. A. Schrijver . Disjoint circuits of prescribed homotopies in a graph on a compact surface . J. Combin. Theory Ser. B , 51 : 127  159 , 1991 .
22. A. Schrijver . Paths in graphs and curves on surfaces . In Proc. First European Congress of Mathematics , Vol. II (Paris, 1992 ), volume 120 of Progr. Math., pages 381  406 . Birkha¨user, Basel, 1994 .
23. C. Thomassen. Embeddings of graphs with no short noncontractible cycles . J. Combin. Theory, Ser. B , 48 : 155  177 , 1990 .
24. G. Vegter and C. K. Yap . Computational complexity of combinatorial surfaces . In Proc. 6th Ann. ACM Symp. Computational Geometry , pages 102  111 , 1990 .
25. U. Zwick. Exact and approximate distances in graphsa survey . In ESA 2001 , volume 2161 of LNCS , pages 33  48 . Springer, Berlin, 2001 .