Topologically Trivial Closed Walks in Directed Surface GraphsResearch on this paper was partially supported by NSF grant CCF-1408763. An extended abstract of this paper will be presented at the 33rd International Symposium on Computational Geometry [33].
\dashlinedash

0.75pt \dashlinegap1.5pt

{bigabstract} Let be a directed graph with vertices and edges, embedded on a surface , possibly with boundary, with first Betti number . We consider the complexity of finding closed directed walks in that are either contractible (trivial in homotopy) or bounding (trivial in integer homology) in . Specifically, we describe algorithms to determine whether contains a simple contractible cycle in time, or a contractible closed walk in time, or a bounding closed walk in time. Our algorithms rely on subtle relationships between strong connectivity in and in the dual graph ; our contractible-closed-walk algorithm also relies on a seminal topological result of Hass and Scott. We also prove that detecting simple bounding cycles is NP-hard.

We also describe three polynomial-time algorithms to compute shortest contractible closed walks, depending on whether the fundamental group of the surface is free, abelian, or hyperbolic. A key step in our algorithm for hyperbolic surfaces is the construction of a context-free grammar with non-terminals that generates all contractible closed walks of length at most , and only contractible closed walks, in a system of quads of genus . Finally, we show that computing shortest simple contractible cycles, shortest simple bounding cycles, and shortest bounding closed walks are all NP-hard.


{rightquote}0.5 So they did what any savvy business would do.
They hired a consultant. They brought in a contractor.
I’m sorry, not a contractor—a contractor.
A man who made words smaller by combining them
or apostrophizing them. \quoteeGary Gulman, Conan, July 13, 2016

1 Introduction

A key step in several algorithms for surface graphs is finding a shortest closed walk and/or simple cycle in the input graph with some interesting topological property. There is a large body of work on finding short interesting walks and cycles in undirected surface graphs, starting with Thomassen’s seminal 3-path condition [63, 54]. For example, efficient algorithms are known for computing shortest non-contractible and non-separating cycles [30, 50, 12, 7, 29], shortest contractible closed walks [10], simple cycles that are shortest in their own homotopy class [11], and shortest closed walks in a given homotopy [19] or homology class [31], and for detecting simple cycles that are either contractible, non-contractible, or non-separating [9]. On the other hand, several related problems are known to be NP-hard, including computing shortest splitting closed walks [13], computing shortest separating cycles [6], computing shortest closed walks in a given homology class [14], and deciding whether a surface graph contains a simple separating or splitting cycle [9].

Directed surface graphs are much less understood, in part because they do not share convenient properties of undirected graphs, such as Thomassen’s 3-path condition [63, 54], or the assumption that if shortest paths are unique, then two shortest paths cross at most once [28]. The first progress in this direction was a pair of algorithms by Cabello, Colin de Verdière, and Lazarus [8], which compute shortest non-contractible and non-separating cycles in directed surface graphs, with running times and . Erickson and Nayyeri described an algorithm to compute the shortest non-separating cycles in time [31]. Later Fox [37] described algorithms to compute shortest non-contractible cycles in time and shortest non-separating cycles in time on surfaces with first Betti number . (For all these bounds, the input size is the total number of vertices, edges, and faces of the input graph.)

This paper describes the first algorithms and hardness results for finding topologically trivial closed walks in directed surface graphs. Our results extend similar results of Cabello, Colin de Verdière, and Lazarus [6, 9] for undirected surface graphs; however, our algorithms require several new techniques, both in design and analysis. (On the other hand, our NP-hardness proofs are actually simpler than the corresponding proofs for undirected graphs!)

We present results for eight different problems, determined by three independent design choices. First, we consider two types of “trivial” closed walks: contractible walks, which can be continuously deformed to a point, and bounding walks, which are weighted sums of face boundaries. Simple bounding cycles are also called separating cycles. (See Section 2 for more detailed definitions.) Second, like Cabello \etal [6, 8, 9], we carefully distinguish between closed walks and simple cycles throughout the paper. Finally, we consider two different goals: deciding whether a given directed graph contains a trivial cycle or closed walk, and finding the shortest trivial cycle or closed walk in a given directed graph (possibly with weighted edges). Crucially, our algorithms do not assume that the faces of the input embedding are open disks. Our results are summarized in Table 1.

Structure Surface Any Shortest
Simple contractible cycle NP-hard
\hdashlineContractible closed walk annulus
torus
with boundary
other
Simple bounding cycle NP-hard NP-hard
\hdashlineBounding closed walk NP-hard
Table 1: Our results; is the first Betti number of the underlying surface.

In Section 3, we describe linear-time algorithms to determine whether a directed surface graph contains a simple contractible cycle or a contractible closed walk, matching similar algorithms for undirected graphs by Cabello \etal [9]. Our algorithms are elementary: After removing some obviously useless edges, we report success if and only if some face of the embedding has a (simple) contractible boundary. However, the proofs of correctness require careful analysis of the dual graphs, and the correctness proof for contractible closed walks relies on a subtle topological lemma of Hass and Scott [42]. We emphasize that these problems are nontrivial for directed graphs even if every face of the input embedding is a disk; see Figure 1.1.

Figure 1.1: A cellularly embedded directed graph with no contractible or bounding closed walks.

In Section 4, we describe an algorithm to determine whether a directed surface graph contains a bounding closed walk in time.111This problem is straightforward for undirected surface graphs, even if we forbid bounding walks with spurs. A connected undirected surface graph supports a spur-free bounding walk if and only if it has either (1) more than one face or (2) more edges than vertices. Our algorithm exploits a careful analysis of the interplay between strong connectivity in the input graph and its dual graph . With some additional effort, our algorithm can return an explicit description of a bounding closed walk in time if one exists; we prove that this quadratic upper bound is optimal. This problem can also be reduced to finding zero cycles in periodic (or “dynamic”) graphs [44, 49, 18]. A periodic graph is a graph whose edges are labeled with integer vectors; a zero cycle is a closed walk whose edge labels sum to the zero vector. However, all algorithms known for finding zero cycles rely on linear programming, and thus are much more complex and much less efficient than the specialized algorithm we present.

In Section 5, we prove that detecting simple bounding cycles, finding shortest simple contractible cycles, and finding shortest bounding closed walks are all NP-hard. Cabello [6] described an algorithm to compute the shortest simple contractible cycle in an undirected surface graph in time; thus, our reduction for that problem makes essential use of the fact that the input graph is directed. Cabello and [6] and Cabello \etal [9] proved that the other two problems are NP-hard in undirected surface graphs. Our NP-hardness proofs closely follow theirs but are slightly simpler.

Finally, in Sections 6 and 7, we describe three polynomial-time algorithms to compute shortest contractible closed walks. Each of our algorithms is designed for a different class of surfaces, depending whether the surface’s fundamental group is abelian (the annulus and the torus), free (any surface with boundary), or hyperbolic (everything else). Our algorithm for the annulus and torus uses a standard covering-space construction, together with a recent algorithm of Mozes \etal [56]. For graphs on surfaces with boundary, we exploit the fact that the set of trivial words for any finitely-generated free group is a context-free language [62, 57]; this observation allows us to reduce to a small instance of the CFG shortest path problem [64, 3]. Our algorithm for hyperbolic surfaces also reduces to CFG shortest paths; the main technical hurdle is the construction of an appropriate context-free grammar. Specifically, for any integers and , we construct a context-free grammar with nonterminals, in Chomsky normal form, that generates all contractible closed walks of length , and only contractible closed walks, in a canonical genus- surface map called a system of quads [51, 34]. Our grammar construction exploits classical geometric properties of hyperbolic tilings: linear isoperimetry [21, 22] and exponential growth [53].

2 Background

Directed Graphs

Let be an arbitrary directed graph, possibly with loops and parallel edges. Each edge of is directed from one endpoint, called its \EMPHtail, to the other endpoint, called its \EMPHhead. An edge is a \EMPHloop if its head and tail coincide. At the risk of confusing the reader, we sometimes write to denote an edge with tail and head .

A \EMPHwalk in is an alternating sequence of vertices and edges , where is an edge in for each index ; this walk is \EMPHclosed if . A \EMPHsimple cycle is a closed walk that visits each vertex at most once. The \EMPHconcatenation of two walks and is the walk \EMPH .

An \EMPHedge cut in a directed graph is a nonempty subset of edges such that has two components, one containing the tails of edges in , and other containing the heads of edges in . A directed graph is strongly connected if it contains a directed walk from any vertex to any other vertex, or equivalently, if it contains no edge cuts.

An (integer) \EMPHcirculation in a directed graph is a function that satisfies a balance constraint for every vertex . The \EMPHsupport of a circulation is the subset of edges such that . An \EMPHEuler tour of a circulation is a closed walk that traverses each edge exactly times; such a walk exists if and only if the support of is connected.

Surfaces, Embeddings, and Duality

A \EMPHsurface is a 2-manifold, possibly with boundary. A surface is \EMPHorientable if it does not contain a Möbius band; we explicitly consider only orientable surfaces in this paper.222As in previous papers [35, 19, 51], all of the problems we consider can be solved for graphs on nonorientable surfaces, with similar running times, by lifting to the oriented double cover. A \EMPHclosed curve on a surface  is (the image of) a continuous map ; a closed curve is \EMPHsimple if this map is injective. The \EMPHboundary of consists of disjoint simple closed curves;the \EMPHinterior of is the complement . The \EMPHgenus of is the maximum number of disjoint simple closed curves in whose deletion leaves the surface connected. Up to homeomorphism, there is exactly one orientable surface with genus and  boundary cycles, for any non-negative integers and . The \EMPHfirst Betti number of is either if , or if .

An \EMPHembedding of a graph on a surface is a continuous map that sends vertices of to distinct points in , and sends edges to interior-disjoint simple paths in from their tails to their heads. In particular, if contains two anti-parallel edges and its reversal , those edges are embedded as interior-disjoint paths. The embedding of maps every (simple) closed walk in  to a (simple) closed curve in ; we usually do not distinguish between a closed walk in and its image in .

We explicitly consider graphs with loops and parallel edges; however, without loss of generality, we assume that no loop edge is the boundary of a disk, and no two parallel edges are the boundary of a disk. (That is, no edge is contractible, and no two edges are homotopic.) With this assumption, Euler’s formula implies that a graph with vertices on a surface with first Betti number has at most edges.

A \EMPHface of the embedding is a component of the complement of the image of the graph. An embedding is \EMPHcellular if every face is homeomorphic to an open disk. Unlike most previous papers, we explicitly consider non-cellular graph embeddings; a single face may have disconnected boundary and/or positive genus. Each directed edge in a surface graph lies on the boundary of two (possibly equal) faces, called the \EMPHleft shore and \EMPHright shore of . We sometimes write \EMPH to denote a directed edge whose left shore is and whose right shore is . A \EMPHboundary face of the embedding is any face that intersects the boundary of .

A \EMPHdual walk is an alternating sequence of faces and edges , where is an edge in  for each index . A dual walk is \EMPHclosed if its initial face and final face coincide; a dual walk is \EMPHsimple if the faces are distinct (except possibly ). A simple closed dual walk is called a \EMPHcocycle. Every minimal edge cut in a surface graph is the disjoint union of at most cocycles; in particular, every minimal edge cut in a planar directed graph is a cocycle and vice versa.

Every surface embedding of a directed graph defines a directed \EMPHdual graph , with one vertex  for each face of , and one edge for each edge of . Specifically, for any edge in , the corresponding dual edge satisfies and . The dual graph can be embedded on the same surface ; however, unless the embedding of is cellular, the embedding of  is not unique. As a consequence, we will treat exclusively as an abstract directed graph. Every dual walk in corresponds to a walk in ; in particular, every cocycle in corresponds to a cycle in .

Figure 2.1: Duality in directed surface graphs

Contractible and Bounding

Let and be two (not necessarily simple) paths in with the same endpoints. A \EMPHhomotopy between and is a continuous function such that and for all , and and for all . Two paths are \EMPHhomotopic, or in the same \EMPHhomotopy class, if there is a homotopy between them.

A closed curve in is \EMPHcontractible in if it can be continuously deformed on to a single point, or more formally, if there is a homotopy from to a constant function. A closed walk in a surface graph is contractible if its image under the embedding is a contractible closed curve. The concatenation of two contractible closed walks is contractible. A simple closed curve (or a simple cycle in ) is contractible in  if and only if it is the boundary of a disk in [27].

Mirroring classical terminology for curves in the plane [58, 1], an \EMPHAlexander numbering for a surface graph  is a function that assigns an integer to each face of , such that for every boundary face . The \EMPHboundary of an Alexander numbering is a circulation, defined by setting . A closed walk is \EMPHbounding if and only if it is an Euler tour of some boundary circulation. Equivalently, a closed walk (or its underlying circulation) is bounding if and only if its integer homology class is trivial. (We refer to reader to Hatcher [43], Giblin [39], or Edelsbrunner and Harer [25] for a more through introduction to homology.) On the sphere or the plane, every closed walk is bounding, and every circulation is a boundary circulation; however, these equivalences do not extend to other surfaces. (See Figure 1.1.) A simple cycle in is bounding in if and only if is disconnected; simple bounding cycles are usually called \EMPHseparating. The concatenation of two bounding closed walks is bounding.

For example, Figure 2.2 shows an Alexander numbering for a directed graph on a surface of genus , which has three vertices, six edges, and three faces. The boundary circulation of this Alexander numbering has value  on both loops and value  on the four edges that are not loops. The closed walk is an Euler tour of this boundary circulation, and thus is a bounding closed walk. (This walk is not contractible, and it is actually the shortest bounding walk in this graph.)

Figure 2.2: An Alexander numbering for a genus-2 surface graph.

Unlike many previous papers, we do not consider homology with coefficients in , because the problems we consider are easy in that setting. A directed surface graph contains a closed walk with trivial -homology if and only if it contains a directed cycle. Our NP-hardness proofs in Section 5 imply that it is NP-hard to find a simple cycle, the shortest cycle, or the shortest closed walk with trivial -homology (or with trivial homology over any ring).

3 Contractible Cycles and Walks

3.1 Simple Cycles

Lemma 3.1

Let be a directed graph embedded on an orientable surface, and let be a directed edge that lies in a directed cocycle of . No bounding closed walk (and in particular, no simple contractible cycle) in  traverses .

{proof}

Let be a directed cocycle in , and let be a bounding closed walk. Let be the boundary circulation defined by setting to the number of times that traverses , and let be an Alexander numbering of (so that ). We immediately have

Because for every edge in , it follows that for every edge .

In light of this lemma, we can assume without loss of generality that contains no directed cocycles; in particular, no edge of has the same face on both sides.

The \EMPHboundary of a face , denoted \EMPH, is the set of edges that have on one side. The boundary of  is oriented \EMPHclockwise if is the right shore of any edge in , and \EMPHcounterclockwise if  is the left shore of any edge in . Each face in with counterclockwise boundary appears as a source in the dual graph ; each face of with clockwise boundary appears as a sink in . We call a face \EMPHcoherent if its boundary is oriented either clockwise or counterclockwise, and \EMPHincoherent otherwise. See Figure 3.1.

Figure 3.1: A simple clockwise contractible cycle (bold green) in a directed surface graph, enclosing four coherent faces: two counterclockwise (shaded blue) and two clockwise (shaded pink).
Lemma 3.2

Let be a directed graph with no cocycles, embedded on an orientable surface . If contains a simple contractible directed cycle, then has a face whose boundary is a simple contractible directed cycle.

{proof}

Let be a simple contractible cycle in . This cycle is the boundary of a closed disk  [27]. Without loss of generality, assume is oriented clockwise around ; that is, the right shore of every edge in is a face in .

A dual walk that starts at a face inside cannot visit the same face more than once, because has no cocycles ( has no cycles), and cannot cross , because is oriented clockwise (all its dual edges point into ). Thus, must contain at least one face with clockwise boundary (a sink in ). The closure of  is a subset of the closed disk , so it must be homeomorphic to a closed disk with zero or more open disks (“holes”) removed from its interior.

If is a simple directed cycle, we are done. Otherwise, is the union of two or more edge-disjoint simple directed cycles; consider the non-simple shaded face in Figure 3.1. Each of these cycles is contractible, because it lies in . Any simple cycle in that is not the original cycle (for example, the boundary of any hole in the closure of ) encloses strictly fewer faces than . The lemma now follows immediately by induction on the number of enclosed faces.

Theorem 3.3

Given an arbitrary directed graph embedded on an arbitrary orientable surface, we can determine in time whether contains a simple contractible cycle.

{proof}

The algorithm proceeds as follows. First, we compute the strong components of the dual graph  in time. An edge of lies in a cocycle if and only if both endpoints of the dual edge lie in the same strong component of ; we remove all such edges from in time. Finally, we examine each face of the remaining subgraph of by brute force, in time. If we discover a face whose interior is a disk and whose boundary is a simple directed cycle, we output True; otherwise, we output False. Correctness follows directly from Lemmas 3.1 and 3.2.

3.2 Non-simple Closed Walks

It is easy to construct directed surface graphs that contain contractible closed walks but no simple contractible cycles. For example, the one-vertex graph in Figure 3.2 has two Eulerian circuits, both of which are contractible, but the only simple cycles consist of single edges, none of which are contractible.

Figure 3.2: A directed surface graph with contractible closed walks but no simple contractible cycles.

We detect contractible closed walks using essentially the same algorithm described in the previous section: After removing all cocycle edges, we look for a face whose boundary is coherent and whose interior is an open disk. However, proving this algorithm correct requires more subtlety.

Fix a graph embedded on an orientable surface . Let be a collection of disjoint open disks in , each containing one of the vertices of ; we refer to each set as a vertex bubble. Let be another collection of disjoint open disks in , each containing the portion of an edge of outside the vertex bubbles, such that if and only if is one of the endpoints of ; we refer to each disk as an edge bubble. Finally, let .

Figure 3.3: Vertex bubbles (green) and edge bubbles (yellow).

We say that a simple closed curve in \EMPHfollows a closed walk in if visits the vertex bubbles of  in exactly the same sequence as the walk visits the corresponding vertices of , and therefore intersects each edge bubble in a disjoint set of simple paths from to , one for each occurrence of the edge in . A closed walk  in is \EMPHweakly simple if contains a simple closed curve that follows , or equivalently (because walks in asymmetric directed graphs cannot contain spurs [16]) if is homotopic in  to a simple closed curve.

Lemma 3.4

Let be a directed graph embedded on an orientable surface . If there is a contractible closed walk in , then there is a weakly simple contractible closed walk in .

{proof}

Let be a contractible closed walk in . Let be a generic closed curve homotopic to  inside the graph neighborhood (and therefore contractible in ) that follows and does not self-intersect inside any edge bubble. For each edge in , the intersection consists of pairwise-disjoint simple paths, each directed from to .

A seminal result of Hass and Scott [42, Theorem 2.7] implies that every non-simple contractible closed curve in contains either a simple contractible closed subpath, which we call a monogon, or a pair of simple interior-disjoint subpaths that bound a disk, which we call a bigon. We call a bigon coherent if one subpath is homotopic to the reverse of the other, and incoherent otherwise. See Figure 3.4.

Figure 3.4: Shortening or simplifying a contractible closed curve by smoothing at points of self-intersection. From left to right: A monogon, a coherent bigon, and an incoherent bigon.

First, suppose contains two homotopic subpaths  and ; these subpaths need not be simple or interior-disjoint. Let be the curve obtained from by smoothing the common endpoints of and , as shown on the right of Figure 3.4. The smoothed curve is homotopic to via a homotopy that swaps the subpaths and  [59, 23, 15]; it follows that  is contractible. Thus, by repeatedly smoothing pairs of vertices, we can reduce to a contractible curve  with no pair of homotopic subpaths, and therefore no incoherent bigons. (If has no pair of homotopic subpaths, then .)

Hass and Scott’s theorem implies that either is simple, or contains a monogon, or contains a coherent bigon. If contains a monogon, that monogon is itself a simple contractible closed curve. If contains a coherent bigon composed of subpaths and , their concatenation is a simple contractible closed curve. In all three cases, we have discovered a simple contractible closed curve in the graph neighborhood . Moreover, for every edge of , the intersection is a subset of , and therefore consists of disjoint simple paths directed from to . Thus, follows a closed walk in , which is both weakly simple [16] and contractible.

Lemma 3.5

Let be a directed graph embedded on an orientable surface . Every weakly simple bounding closed walk in traverses each edge of at most once.

{proof}

Let be a weakly simple bounding closed walk in . Let be a simple closed curve in that follows , as in the previous proof. Because is simple and bounding, the set has exactly two components. Color the component on the left of blue, and the component on the right of red.

Consider a single edge . Each component of is a directed path that splits into a blue region on the left and a red region on the right. Thus, the components of must alternate direction, as shown in Figure 3.5, since otherwise some component of would be both red and blue.

Figure 3.5: A simple contractible cycle in must alternate directions inside any edge bubble.

By assumption, even if contains an edge from to , that edge is embedded disjointly from . Thus, every path component of is directed from to . It follows that is either empty or a single directed path, which implies that traverses at most once.

Corollary 3.6

Let be a directed graph with vertices and non-negatively weighted edges, embedded on an orientable surface, possibly with boundary. The shortest contractible closed walk in , if such a walk exists, has hop-length at most .

Lemma 3.7

Let be a directed graph with no cocycles, embedded on an orientable surface. If contains a contractible closed walk, then has a face with coherent boundary whose interior is a disk.

{proof}

Let be a weakly-simple contractible closed walk in (as guaranteed by Lemma 3.4). Smoothing  at its vertices yields a simple contractible closed curve in that follows ; this closed curve is the boundary of an open disk  [27]. Following terminology for face boundaries, we say that is oriented clockwise if  lies to the right of and counterclockwise otherwise. We say that encloses a face  if the interior region lies inside the disk .

Let denote the area enclosed by , defined as the interior of the union of the closure of all faces enclosed by . Area has genus zero and connected boundary (by Lemma 3.5), so each component of  is an open disk. If is disconnected, then the boundary of each component of is a contractible closed walk that encloses fewer faces than . Thus, we can assume without loss of generality that  is a single open disk. However, we cannot assume that itself is simple; the closure of might have holes and/or positive genus. (See Figures 3.2 and 3.6.)

Figure 3.6: A non-simple walk that encloses an open disk.

Without loss of generality, assume is oriented clockwise. A dual walk that starts at a face enclosed by cannot visit the same face more than once, because has no cocycles ( is a dag), and cannot cross , because is oriented clockwise (all its dual edges point into ). Thus, must enclose at least one face with clockwise boundary (a sink in the dual graph ).

The interior of  is a subset of the open disk , so it must be homeomorphic to an open disk with zero or more holes. If is an open disk (and in particular, if ), we are done. Otherwise, let be closed walk that exactly covers the boundary of any interior hole of . Because lies entirely inside the open disk , it must be contractible. Thus, is a weakly simple contractible closed walk that encloses strictly fewer faces than , and the lemma follows immediately by induction.

Theorem 3.8

Given a directed graph embedded on any surface, we can determine in time whether there is a contractible closed walk in .

{proof}

We use essentially the algorithm described by Theorem 3.3: Remove all cocycle edges from by considering the strong components of the dual graph , and then examine the faces of the remaining subgraph by brute force. If we discover a face with coherent boundary whose interior is a disk, we output True; otherwise, we output False. Correctness follows directly from Lemmas 3.1 and 3.7.

In the last stage of the proof, if the face has an interior hole, then the graph must be disconnected, because the interior of is a subset of the open disk . Thus, it may tempting to simplify the proof of Lemma 3.7 by assuming that the graph is connected. Unfortunately, we cannot simultaneously assume that is connected and that contains no cocycles. Resolving this tension lies at the core of our algorithm for finding bounding closed walks, which we describe next.

4 Bounding Closed Walks

To simplify our presentation, we assume in this section that our input graphs are embedded on surfaces without boundary; this assumption is justified by the following observation. Let be a directed graph embedded on a surface with boundary components. Let be the surface without boundary obtained from by attaching a single disk with holes to the boundary cycles of . Thus, every boundary face of on the original surface is contained in a single face of on . If has first Betti number , then has genus .

Lemma 4.1

A closed walk in is bounding in if and only if it is bounding in .

{proof}

Any Alexander numbering for on is also an Alexander numbering for on .

Let be any Alexander numbering for on . For any integer , the function defined as for every face is also an Alexander numbering for on . Thus, there is an Alexander numbering of such that for the single face of containing . The function  is an Alexander numbering for on .

4.1 Detection

Our algorithm for detecting bounding closed walks relies on two elementary observations. First, we can assume without loss of generality that is strongly connected, because any closed walk in the input graph stays within a single strong component of . On the other hand, Lemma 3.1 implies that we can assume without loss of generality that the input graph  has no cocycles; otherwise, we can remove all cocycles in time by contracting each strong component of the dual graph to a single dual vertex. Indeed, if the input graph satisfies both of these conditions, detecting bounding closed walks is trivial.

Lemma 4.2

Let be a strongly connected surface graph with at least one edge, whose dual graph is acyclic. There is a bounding closed walk in .

{proof}

For each face of , let be the rank of the dual vertex in an arbitrary topological sort of the dual graph . For each edge in , we have . Thus, the function is a positive integer boundary circulation with connected support. Any Euler tour of this circulation is a bounding closed walk.

Kao and Shannon [47, 48, 45] observed that these two assumptions are actually identical for planar graphs; a planar directed graph is strongly connected if and only if its dual graph is acyclic. (This important observation is the basis of several efficient algorithms for planar directed graphs [47, 48, 45, 46, 61, 2].) And indeed, finding bounding closed walks in planar graphs is trivial, because every closed walk in a planar graph is bounding.

However, this equivalence does not extend to directed graphs on more complex surfaces; a strongly connected directed surface graph can contain many directed cocycles. Moreover, deleting all the directed cocycles from a strongly connected surface graph can disconnect the graph. More subtly, if is a disconnected surface graph without cocycles, the induced embeddings of the individual components of can contain cocycles. See Figure 4.1.

Figure 4.1: A strongly connected directed graph on the torus with cocycles (bold red). Deleting all cocycles disconnects the graph. The components of the disconnected graph have more cocycles. (Only one cocycle is emphasized in each component.)

Our algorithm repeatedly applies both of these simplifications, alternately removing cocycle edges and separating components, eventually reporting success if it ever finds a component that is both strongly connected and cocycle-free. Each iteration can be performed in linear time, and each iteration removes at least one edge from the graph; thus, conservatively, our algorithm runs in time. But in fact, as we show next, our algorithm converges after only iterations.

Lemma 4.3

Let be a directed surface graph without cocycles. Every weak component of is strongly connected.

{proof}

If a weak component of is not strongly connected, then contains a non-empty directed edge cut. Every non-empty directed edge cut is the disjoint union of cocycles.

We call any face of \EMPHsimple if it is homeomorphic to an open disk and \EMPHnon-simple otherwise. (The boundary of a simple face is not necessarily a simple cycle.)

Lemma 4.4

Let be a strongly connected surface graph, let be the subgraph of obtained by deleting all cocycles, and let be a (strong) component of . Every simple face of is also a simple face of .

{proof}

Let be an arbitrary simple face of . There are two cases to consider.

First, suppose contains no vertices of in its interior. Then any cocycle in that passes through a face inside must contain at least one edge on the boundary of . But by definition, every edge on the boundary of  is an edge in . It follows that no cocycle in passes through a face in the interior of , and thus no cocycle in includes an edge in the interior of . We conclude that is actually a face of .

On the other hand, suppose some vertex of lies inside the open disk . Then is disconnected from the boundary of in by removing cocycles in . None of these cocycles contain an edge on the boundary of , because all such edges survive in , so  must contain a cocycle whose edges and faces are entirely inside . This cocycle must be a directed edge cut in , because every directed cocycle inside a disk is a directed edge cut. But no such edge cut exists, because is strongly connected.

Corollary 4.5

Let be a strongly connected surface graph, let be the subgraph of obtained by deleting all cocycles, and let be a (strong) component of . Every directed cocycle in visits at least one non-simple face of .

We define the \EMPHfootprint of a directed surface graph as the union of the vertices, edges, and simple faces of . For example, the footprint of the middle graph in Figure 4.1 is the disjoint union of two annuli. The embedding of is cellular if and only if is the entire surface. Let \EMPH denote the number of (weak) components of , or equivalently, the number of components of its footprint . Let \EMPH denote the first Betti number of , which is the rank of the first homology group of . If  has at least one non-simple face, then

where , , and denote the number of vertices, edges, and simple faces of , respectively. If  (and therefore ) is disconnected, then is the sum of the first Betti numbers of its components.

Lemma 4.6

Let be a strongly connected surface graph, let be the subgraph of obtained by deleting all cocycles, let be a (strong) component of , and let be the subgraph of obtained by deleting all cocycles. If , then .

{proof}

Assume , so contains at least one cocycle. Corollary 4.5 implies that every cocycle in passes through a non-simple face of . Thus, every cocycle in can be decomposed into edge-disjoint dual arcs of the form , where the initial face and final face are non-simple, and the intermediate faces are simple and distinct.

Let be any dual arc in . Because is strongly connected, is not a directed edge cut, and therefore is (at least weakly) connected. It follows that .

For any other dual arc in , the edges in define one or more dual arcs in . Thus, we can proceed inductively as follows. Define a sequence of nested subgraphs , where each subgraph is obtained by deleting a dual arc from , and the final subgraph contains no dual arcs (and therefore no cocycles). For each index , either is an edge cut in , which implies , or  is not an edge cut, which implies . The lemma now follows by induction.

Theorem 4.7

Given a directed graph embedded on any surface with genus , we can determine in time whether there is a bounding closed walk in .

{proof}

Assume is strongly connected, since otherwise, we can consider each strong component of  separately. Let be the graph obtained by deleting all cocycles of . We can construct in time by computing the strong components of in linear time, and then deleting any edge of whose incident faces lie in the same strong component of . Lemma 3.1 implies that any bounding closed walk in is also a bounding closed walk in .

If has no edges, we can immediately report that has no bounding closed walks. If is weakly connected and has at least one edge, then Lemmas 4.2 and 4.3 imply that contains a bounding closed walk. Otherwise, we recursively examine each (strong) component of .

Each vertex of the original input graph participates in only one subproblem at each level of recursion, so the total time spent at each level of the recursion tree is . Finally, Lemma 4.6 implies that the depth of the recursion tree is at most .

Call the subgraph obtained from by alternately removing cocycles and isolating components the snarl of ; the snarl is the largest subgraph of in which every component is strongly connected and cocycle-free. We conjecture that the snarl of a surface graph (or at least one nontrivial component thereof) can actually be extracted in time.

4.2 Explicit Construction

This algorithm described in Theorem 4.7 only reports whether contains a closed bounding walk; it does not actually compute such a walk. With some additional straightforward bookkeeping, we can compute an implicit representation of a bounding closed walk as an Alexander numbering of the faces of , without increasing the running time of our algorithm. The complexity of this implicit representation is . If necessary, we can then obtain an explicit bounding closed walk, as an alternating sequence of vertices and edges, by computing an Euler tour of the circulation , as described in the proof of Lemma 4.2. Because each Alexander number is an integer between and , the total length of this Euler tour is , and we can compute in time using standard Euler-tour algorithms.

Corollary 4.8

Let be a directed surface graph with vertices. In time, we can either compute an explicit description of a bounding closed walk in or report correctly that no such walk exists.

Corollary 4.9

Let be a directed surface graph with vertices. The shortest bounding closed walk in  (if such a walk exists) has length .

For graphs on the sphere or the torus, every bounding closed walk is actually contractible, so Lemmas 3.4 and 3.5 imply that the shortest bounding closed walk actually has length , and Theorem 3.8 implies that we can find an explicit bounding closed walk in time. For graphs on even slightly more complicated surfaces, however, our quadratic upper bounds are actually tight.

Theorem 4.10

For any fixed integer and any positive integer , there is a directed graph with vertices and edges, embedded on an orientable surface of genus , in which the shortest bounding closed walk has length .

{proof}

It suffices to consider the case . Let be a directed graph consisting of a directed cycle of length (“the long cycle”), a chain of cycles of length (“the short cycles”), and a single cycle of length  (“the self-loop”), embedded on a surface of genus as shown in Figure 4.2 (for ). This embedding has faces, of which two are annuli and the rest are disks. The long cycle and the self-loop both lie on the common boundary of both annular faces.

Figure 4.2: A directed surface graph with only long bounding closed walks, with a minimal valid Alexander numbering.

The dual graph consists of a directed path , where and are the annular faces, plus additional edges directly from to . Because is a dag, has no cocycles, and so Lemma 4.2 implies that there is a bounding closed walk in . Specifically, the function for all is the Alexander numbering of a bounding circulation; again, see Figure 4.2.

The subgraph of edges traversed by any closed walk is strongly connected. Straightforward exhaustive case analysis implies that the only strongly connected subgraph of that contains both the long cycle and the self-loop is the entire graph . Thus, every strongly connected proper subgraph of omits either the entire long cycle or the self-loop. In either case, faces and of belong to a single face of . Thus, the dual graph  is strongly connected, and Lemma 3.1 implies that cannot support a bounding closed walk. We conclude that every bounding closed walk in traverses every edge of  at least once.

Now let be any bounding closed walk in that traverses every edge at least once, and let be the Alexander numbering of . For each edge , we must have , so must be consistent with the only topological order of . It follows that . Thus, must traverse both the long cycle and the self-loop times, and every other edge of at least once. We conclude that must have length at least . (This is exactly the length of any bounding closed walk induced by the Alexander numbering , so our analysis is tight.)

One frustrating source of complexity in our construction is the long cycle of degree-2 vertices. A different construction with no degree- vertices yields a lower bound of on any surface of genus ; we leave this construction as an amusing exercise for the reader, and a proof or disproof of its optimality as an open problem.

5 NP-hardness

5.1 Simple Bounding Cycles and Shortest Bounding Walks

Our algorithms for detecting contractible closed walks and simple contractible cycles are essentially identical: Remove all cocycles, and then check the boundary of every face. Unfortunately, this similarity does not extend to bounding walks and bounding cycles. In this section, we prove that determining whether a directed surface graph contains a simple bounding cycle is NP-hard. The same reduction also implies that finding the shortest bounding closed walk in a directed surface graph is NP-hard, even if all edges have weight .

Our proof uses a variant of the “heaven and hell” NP-hardness reduction of Cabello \etal [9] for the corresponding problem in undirected graphs, which is based in turn on a reduction of Chambers \etal [13] for the problem of finding the shortest closed walk in an undirected surface graph that is separating but non-contractible. In fact, our reduction is simpler than either of these earlier arguments, because our underlying graphs are directed.

We reduce from the Hamiltonian cycle problem in directed planar graphs, where every vertex has either in-degree and out-degree , or in-degree and out-degree . This problem was proved NP-hard by Plesńik [60], using a direct reduction from 3Sat.

Let be a planar directed graph. Fix a planar embedding of on the sphere (“Earth”). Ultimately, we will construct an embedding of the same graph on a more complex surface , such that has a Hamiltonian cycle if and only if has a closed walk of length at most that is bounding in .

As a preliminary step, we partially color the faces of as follows. Call an edge of \EMPHforced if it is the only edge leaving a vertex or the only edge entering a vertex (or both). Color the left shore of every forced edge blue, and color the right shore of every forced edge red. A face may be colored both red and blue, or not colored at all; see Figure 5.1.

Figure 5.1: Coloring the faces of cubic directed planar graphs; bold green edges are forced. The graphs differ only in the direction of three edges at the top of the central face. The second graph is not Hamiltonian, because its central face is colored both red and blue.
Lemma 5.1

If has a Hamiltonian cycle, then no face of is colored both red and blue.

{proof}

Suppose contains a Hamiltonian cycle . By definition, visits each vertex of exactly once, so is a simple closed curve that traverses every forced edge in . Thus, each blue face is on the left side of , and each red face is on the right side of . The lemma now follows immediately from the Jordan curve theorem.

Assuming no face of is colored both red and blue, we construct the surface in two stages. First we delete a small disk from the interior of each blue face and attach the resulting punctures to another punctured sphere, thereby merging all blue faces into a single blue face, which we call heaven. Similarly, we delete a small disk from the interior of each red face and attach the resulting holes to a single punctured sphere, merging all the red faces into a single red face, which we call hell. Euler’s formula implies that the resulting surface has genus .

Lemma 5.2

The following statements are equivalent: (a)  contains a Hamiltonian cycle. (b)  contains a simple cycle that is bounding in . (c) There is a closed walk in that is bounding in and has length at most .

{proof}

We prove the implication (a)(b) first. Suppose is a Hamiltonian cycle in . Viewed as a cycle in the original planar embedding, separates all blue face from all red faces. Thus, the embedding of on separates heaven from hell; it follows that is a bounding cycle in .

The implication (b)(c) is trivial.

Finally, we prove the implication (c)(a). Suppose is a closed walk in that is bounding in  and has length at most . Fix an Alexander numbering of the faces of on that is consistent with . Because visits at least one vertex of , it traverses at least one forced edge. It follows that , which implies that traverses every forced edge, and thus visits every vertex. We conclude that is a Hamiltonian cycle.

Theorem 5.3

Deciding whether a directed surface graph contains a simple bounding cycle is NP-hard.

Theorem 5.4

Computing the shortest bounding closed walk in a directed surface graph is NP-hard.

Both of these NP-hardness results hold even if we insist on cellularly embedded graphs. Without loss of generality, suppose the original input graph is connected, since otherwise it cannot contain a Hamiltonian cycle. It follows that heaven and hell are the only non-disk faces in ’s embedding on . Thus, we can extend to a cellularly embedded graph by adding a single vertex in the interior of heaven, with directed edges from one vertex on the boundary of each blue face, and a single vertex in the interior of hell, with edges from one vertex on the boundary of each red face. Because the two new vertices are sinks, they cannot appear in any (bounding) closed walk in .

5.2 Shortest Trivial Cycles

Now we prove that finding the shortest simple contractible cycle in a directed surface graph is NP-hard, by reduction from the classical maximum independent set problem. Our reduction is nearly identical to a reduction of Cabello [6], who proved that finding the shortest simple bounding cycle in an undirected surface graph is NP-hard. In the same paper, Cabello described an algorithm to compute the shortest contractible cycle in an undirected surface graph in time; thus, our NP-hardness proof must make essential use of the fact that the input graph is directed.

Given an undirected graph with vertices and edges and a positive integer , we first construct a directed planar graph as follows. Arbitrarily identify the vertices of with the integers through . For each integer the graph contains a corresponding vertex , along with two directed paths and from vertex to vertex . Path has length , and path has length . Label the vertices of as , where are the neighbors of vertex in (in no particular order). Thus, for each edge of , there are two corresponding vertices in , namely in and in . In total, has vertices and edges.

We embed on the sphere so that one face is bounded by the paths , another face is bounded by the paths , and each of the remaining faces is bounded by and for some index . See Figure 5.2.

Figure 5.2: Reduction from maximum independent set to shortest contractible cycle in a directed surface graph.

A simple cycle in is compliant if, for every edge in , does not use both of the vertices and in .

Lemma 5.5

contains an independent set of size if and only if contains a simple compliant cycle of length at most .

{proof}

First, suppose has an independent set of size . For each integer , let if , and define otherwise. Let be the simple cycle formed by concatenating the paths . This cycle is compliant, because there are no edges in between the vertices in . Straightforward calculation implies that the length of is .

On the other hand, suppose contains a compliant cycle of length . Every cycle in is the concatenation of paths , where for each index , either or . Because is compliant, cannot contain both and , for any edge of . Thus, the set of indices is an independent set in . Straightforward calculation implies .

We now convert into a directed graph embedded on a more complex surface as follows. Let  be the face of bounded by paths . For each edge of the original graph , let and denote two small simple closed curves, respectively passing through vertices and of , and otherwise in the interior of . To define both the new graph and the surface , we remove the interiors of all curves and then identify each curve with its twin , so that vertices and are identified and the resulting surface is orientable. The resulting surface has genus .

Lemma 5.6

For any integer , there is a simple compliant cycle of length in if and only if there is a simple cycle of length in that is contractible in .

{proof}

First, let be any simple cycle in . The edges in are in one-to-one correspondence with edges in , and sequence of edges corresponding to defines a closed walk in with the same length at . Because the construction of and only involves surgery on the interior of the single face , the corresponding closed walk in is contractible in . Finally, if is compliant, then is simple.

Now let be a simple contractible cycle in . For each edge of the original graph , the curve intersects at exactly one vertex and therefore crosses at most once. Because  is contractible, crosses every closed curve in an even number of times. It follows that does hot cross any curve . Thus, the corresponding sequence of edges in defines a simple cycle . Finally, because  visits each vertex at most once, is compliant.

Theorem 5.7

Finding the shortest simple contractible cycle in a directed surface graph is NP-hard.

The statement and proof of Lemma 5.6 still hold without further modification if we replace every instance of the word “contractible” with the word “bounding” or “separating”. Indeed, every bounding cycle in is actually contractible.

Theorem 5.8

Finding the shortest simple bounding cycle in a directed surface graph is NP-hard.

6 Shortest Contractible Closed Walks: The Easy Cases

Now we describe polynomial-time algorithms to find a shortest contractible closed walk in a directed surface graph with weighted edges. For this problem, it will prove convenient to treat input graphs as undirected, but with asymmetric edge weights, as proposed by Cabello \etal [10]. That is, each undirected edge in the input graph is composed of two darts and with independent weights; a walk is alternating series of vertices and darts; and the length of a walk is the sum of the weights of its darts, counted with appropriate multiplicity. We also assume without loss of generality that the given embedding of is cellular, meaning every face is homeomorphic to an open disk. Both of these assumptions can be enforced by adding at most directed edges with (symbolically) infinite weight, where is the first Betti number of the underlying surface. Finally, to avoid issues with negative cycles, we assume all edge weights are non-negative.

All orientable 2-manifolds can be partitioned into four classes, depending on the structure of their fundamental group.

  • The sphere and the disk have trivial fundamental groups.

  • The annulus and the torus have abelian fundamental groups.

  • Every surface with boundary has a free fundamental group.

  • Every surface without boundary and with genus at least has a hyperbolic fundamental group.

All closed curves on the sphere or the disk are contractible, so our problem is trivial for those surfaces. We develop a separate polynomial-time algorithm for each of the other three classes.

Our algorithm for the annulus and the torus, described in Section 6.1, constructs a finite relevant portion  of the universal cover of the input graph, and then finds the shortest directed cycle in  using a recent algorithm of Mozes \etal [56]. Our algorithm for surfaces with boundary, described in Section 6.2, exploits an observation by Smikun [62] and Muller and Schupp [57] that the set of trivial words for any finitely-generated free group is a context-free language. After carefully labeling the input graph, we invoke an algorithm of Barrett \etal [3] that finds the shortest walk in a given graph whose structure is consistent with a given context-free grammar. We defer discussion of the hyperbolic case to Section 7.

6.1 Annulus and Torus (Abelian)

The universal cover of a surface graph is an infinite planar graph, constructed by tiling the plane with an infinite number of copies of a disk called the \EMPHfundamental domain, obtained by cutting the underlying surface along a system of loops [26, 50] or a system of arcs [32]. A closed walk in is contractible if and only if it is the projection of a closed walk in . Thus, the shortest contractible walk in  is the projection of the shortest directed cycle in .

Corollary 3.6 implies that we can find the shortest contractible closed walk in by searching a relevant region of , assembled from a finite copies of the fundamental domain, and just large enough to contain at least one lift of every closed walk of length in . The assembled graph  is planar, so we can find the shortest directed cycle in time, where is the number of vertices in , using the recent algorithm of Mozes \etal [56].

This approach immediately gives us efficient algorithms when the fundamental group of the underlying surface is abelian. There are only two such surfaces:

Theorem 6.1

Given a directed graph with vertices and non-negatively weighted edges embedded on the annulus, we can find the shortest contractible closed walk in in time.

{proof}

We can compute an appropriate fundamental domain in time by slicing the annulus along any path in between the two boundaries of the annulus. consists of at most copies of the fundamental domain and thus has complexity .

Theorem 6.2

Given a directed graph with vertices and non-negatively weighted edges embedded on the torus, we can find the shortest contractible closed walk in in time.

{proof}

We can compute an appropriate fundamental domain in time by slicing the surface along any system of loops [26, 50]. consists of at most copies of the fundamental domain and thus has complexity .

In principle, we can use the same covering-space approach to find shortest contractible closed walks in graphs on arbitrary surfaces. Unfortunately, for every nontrivial surface other than the annulus and the torus, covering all paths of length requires exponentially many copies of the fundamental domain.

6.2 Surfaces with Boundary (Free)

The fundamental group of a surface with genus and boundary cycles is a free group with generators. Smikun [62] and Muller and Schupp [57] observed that the set of trivial words for any finitely-generated free group is a context-free language.333More generally, both Smikun and Muller and Schupp proved that the set of trivial words for a finitely-presented group is a context-free language if and only if the group has a free subgroup with finite index.

This observation allows us to reduce finding shortest contractible walks on surfaces with boundary to the \EMPHCFG shortest path problem, introduced by Yannakakis [64]. Given a directed graph with weighted edges, a labeling for some finite set , and a context-free grammar  over the alphabet , the CFG shortest path problem asks for the shortest walk (if any) in  whose label is in the language generated by . An algorithm of Barrett \etal [3] solves the CFG shortest path problem in time, where and are the numbers of nonterminals and productions in , respectively, and is the number of vertices in , when the grammar  is in Chomsky normal form and all edge weights in  are non-negative. (Their algorithm was extended to graphs with negative edges but no negative cycles by Bradford and Thomas [4].)

Theorem 6.3

Given a directed graph with non-negatively weighted edges, embedded on a surface  with boundary with first Betti number , we can find the shortest contractible closed walk in in time.

{proof}

Our algorithm begins by constructing a system of dual arcs for —a collection of boundary-to-boundary paths in that cut the underlying surface into a disk. Such a system can be constructed in time [32], using a natural variant of Eppstein’s tree-cotree construction of systems of loops [26]. If necessary, we subdivide the edges of (introducing parallel edges into ) so that these dual arcs are simple and edge-disjoint, as described by Cabello and Mohar [12] for systems of loops. After subdivision, has at most edges and therefore (because is symmetric) at most vertices. We arbitrarily direct each arc . Finally, we label each directed edge of with a generator if it crosses the corresponding dual arc from left to right, with an inverse generator if it crosses  from right to left, and with the empty string otherwise.

Any closed walk in is naturally labeled with a string obtained by concatenating the labels of its edges in order. A closed walk is contractible if and only if its label can be reduced to the empty string by repeatedly removing substrings of the form or āa, where a is a generator and ā is its inverse. The set of all such reducible strings is generated by the following Chomsky normal form context-free grammar :

I

Specifically, the starting nonterminal I generates reducible strings; each non-terminal generates strings that reduce to the corresponding generator ; each barred non-terminal generates strings that reduce to the corresponding inverse generator .

We are now left with instance of the CFG shortest path problem with non-terminals and productions in a graph with vertices, which can be solved in time by the algorithm of Barrett \etal [3].

7 Shortest Contractible Closed Walks: The Hyperbolic Case

Finally, we describe our algorithm to compute shortest contractible closed walks on surfaces with no boundary and with genus at least . All such surfaces have hyperbolic fundamental groups in the sense of Gromov [41]; as observed by Dehn over a century ago [20], the most natural geometry for the universal cover of these surfaces is the hyperbolic plane. (See Figure 7.2 below.)

Neither of the algorithms described in Section 6 apply to graphs on hyperbolic surfaces. As we already mentioned, adapting the covering-space algorithm from Section 6.1 would require exponentially many copies of the fundamental domain. (See Lemma 7.1 below.) On the other hand, the set of trivial words for a hyperbolic group is not a context-free language [57], so we cannot apply our algorithm from Section 6.2 directly. Nevertheless, we solve our problem by reduction to the CFG-shortest path algorithm of Barrett \etal [3], by constructing a grammar that generates all sufficiently short contractible closed walks in a certain canonical surface map.

Fix an undirected graph embedded on an orientable surface with genus and no boundary. As in the previous section, we assume without loss of generality that is symmetric, the embedding of is cellular, and all edge weights are non-negative.

7.1 Edge Labeling

The first step in our algorithm is to label the edges of so that the labels along any closed walk encode its homotopy type. In principle, we can derive such a labeling by reducing to a system of loops [24, 12, 50]; however, this labeling leads to a less efficient algorithm.444See footnote 5. Instead, we reduce to a different canonical surface decomposition called a system of quads, as proposed by Lazarus and Rivaud [51] and Erickson and Whittlesey [34].

Let be an arbitrary tree-cotree decomposition of , which partitions the edges of into a spanning tree , a spanning tree of the dual graph , and exactly leftover edges [26]. Contracting every edge in and deleting every edge in reduces to a system of loops, which has one vertex , one face , and loops . To construct the system of quads , we introduce a new vertex in the interior of , add edges between and every corner of , and then deleting the edges in .

Next we label each directed edge in with a directed walk \EMPH in as follows. Every walk starts and ends at and thus has even length. If , then is the empty walk. Otherwise, after contracting , edge connects two corners of ; we define as the walk of length in from the back corner of , to , and then to the front corner of . (If , there are two possibilities for ; choose one arbitrarily.)

Figure 7.1: Left: A fundamental polygon for a surface of genus , obtained by contracting a spanning tree and cutting along a system of loops. Right: Mapping a directed non-tree edge to a path of length in the corresponding system of quads.

Finally, for any closed walk in , let denote the closed walk in obtained by concatenating of the labels of edges in . The closed walks and are freely homotopic in ; in particular, is contractible if and only if is contractible. Moreover, the number of edges in is at most twice the number of edges in .

The universal cover of a system of quads is isomorphic to a regular tiling of the hyperbolic plane by quadrilaterals meeting at vertices of degree ; see Figure 7.2. The covering map from to is a graph homomorphism (mapping vertices to vertices and edges to edges), which at the risk of confusing the reader, we also denote . A closed walk in is contractible if and only if it is the projection of a closed walk in . Thus, a closed walk in is contractible if and only if there is a closed walk in  such that .

Figure 7.2: The universal cover of a genus-2 system of quads. (Compare with Figure 7.1.)

7.2 Hyperbolic Geometry

Our algorithm exploits two well-known geometric properties of regular hyperbolic tilings: the area of any ball in a hyperbolic tiling grows exponentially with its radius [53, 40], and the area enclosed by any simple cycle grows at most linearly with the cycle’s length [21, 22]. In particular, we rely on the following immediate corollary of these two properties: The distance from any point in the interior of a simple cycle in a regular hyperbolic tiling is at most logarithmic in the length of that cycle; see Figure 7.3.

Figure 7.3: Simple closed curves in hyperbolic tilings have logarithmic in-radius.

Classical results already imply this qualitative behavior for all regular hyperbolic tilings; indeed, Chepoi \etal [17] have derived tight asymptotic bounds. However, we require precise bounds for growth, isoperimetry, and in-radius in the specific tiling , because the running time of our eventual algorithm depends exponentially on the constants in those bounds.

Fix an arbitrary vertex of called the basepoint. For any positive integer , let \EMPH denote the number of vertices in at distance exactly from , and let \EMPH denote the number of vertices at distance at most from .

Lemma 7.1

for some constants and . In particular, for all .

{proof}

Every node at distance from the basepoint has either zero or one neighbors at distance from the basepoint. Thus, we can write , where each is the number of nodes at distance  that have neighbors at distance . We immediately have and . Floyd and Plotnick [36] prove that these functions satisfy the following recurrence:

(Moran [55] derives similar recurrences for a slightly different growth function.) Standard techniques now imply that for some constant , where and are the roots of the polynomial ; specifically, we have

Straightforward calculation implies . It follows that , where .

Moreover, a straightforward but tedious induction argument implies that and for all . We conclude that for all ; the remaining case is trivial.

Lemma 7.2

Any simple cycle of length in has less than faces of in its interior.

{proof}

Our proof follows the “spur and bracket” analysis of Erickson and Whittlesey [34, Section 4.2], which is based in turn on results of Gersten and Short [38].

Let be a nontrivial simple cycle in , without loss of generality oriented counterclockwise around its interior faces (if any). The turn of any vertex of is the number of interior tiles incident to  that locally lie to the left of . A (left) bracket is a subpath of whose first and last vertices have turn and whose intermediate vertices have turn . A discrete curvature argument, ultimately based on Euler’s formula, implies that any has at least four brackets [38, Corollary 5.1][34, Lemma 4.1]. In particular, has at least four distinct vertices with turn .

Let denote the number of edges in , let denote the number of interior tiles enclosed by , and let , where denotes the number of vertices of with turn . Trivially, .

We can reduce the length of by sliding a bracket, as shown in Figure 7.4. Intuitively, sliding a bracket of length  replaces a subpath of length around three sides of a rectangle of tiles with a path of length  around the fourth side of that rectangle. This replacement removes the turn- vertices at the ends of the bracket, changes the turns of the vertices in the interior bracket from to , and decreases the turns of the vertices adjacent to the bracket by .

Figure 7.4: Removing a bracket; vertex labels are turns (modulo ).

Sliding a bracket creates a spur (an edge followed by its reversal) if and only if that bracket is adjacent to a vertex with turn , and thus another bracket with length . The only simple cycle that contains two consecutive length- brackets is the boundary of a single tile. Thus, either is a single tile boundary, or removing the shortest bracket yields a shorter simple cycle . In the latter case, we immediately have

where is the length of the bracket. It follows by induction that can be reduced to a single tile boundary by a sequence of bracket slides, and

where is the length of the th bracket. We conclude that , and therefore .

Lemma 7.3

Any simple cycle of length in has less than