Algorithm for filling curves on surfaces

Let $\Sigma$ be a compact, orientable surface of negative Euler characteristic, and let $h$ be a complete hyperbolic metric on $\Sigma$. A geodesic curve $\gamma$ in $\Sigma$ is filling, if it cuts the surface into topological disks and annuli. We propose an efficient algorithm for deciding whether a geodesic curve, represented as a word in some generators of $\pi_1(\Sigma)$, is filling. In the process, we find an explicit bound for the combinatorial length of a curve given by its Dehn-Thurston coordinate, in terms of the hyperbolic length. This gives us an efficient method for producing a collection which is guaranteed to contain all words corresponding to simple geodesics of bounded hyperbolic length.


Introduction
Let Σ be a compact, orientable surface of negative Euler characteristic. Recall, a curve γ : S 1 → Σ is said to be in minimal position, if it is self-transverse, and the number of self-intersections is minimal over all curves freely homotopic to γ. A curve γ in minimal position is filling if Σ − γ is a collection of topological disks and annuli, such that each annulus is homotopic to a boundary component of Σ.
The main result of this note is the following: Theorem 1.1. There exists a polynomial time algorithm to determine whether a curve γ in Σ is filling.
The input of the algorithm in Theorem 1.1 is a word of length L in some fixed generating set X of π 1 (Σ). We show that our algorithm terminates in O(L 2N +2 ) time, where N denotes the complexity of the surface Σ. If Σ has genus g and n boundary components, recall that its complexity is defined to be N = 3g − 3 + n.
We point out that there exists another algorithm for determining whether a curve is filling, as given in the PhD thesis [Are15]. The basic idea of [Are15] is to construct a curve with minimal self-intersection, corresponding to a word in a generating set of π 1 (Σ). The algorithm then gives a way of detecting whether the complementary regions of the curve are (possibly punctured) disks. As will be explained in the following paragraph, our approach is much different and unlike the above, we get estimates for the running time of our algorithm.
Let us fix a complete hyperbolic metric on Σ. From here on, we identify each curve γ in Σ with its free homotopy class in Σ, and define its length l(γ) to be the length of the unique geodesic in that class. The intersection between two curves γ and γ is taken to be the minimum number of transverse intersections between any two curves homotopic to γ and γ , respectively. One can easily see that a curve is filling, if and only if it intersects every simple curve in Σ. In fact, a sufficient condition for γ to be filling is that it intersects every simple curve of length at most twice the length of itself (Lemma 4.1).
Our strategy to prove Theorem 1.1 will thus be as follows. Given a curve γ, we will construct a set containing all words in some generating set X of π 1 (Σ) corresponding to simple curves of length bounded by 2l(γ). We will then check whether each curve in our set intersects γ, thus determining whether γ is filling. To that end, there exists a number of algorithms for calculating the intersection number of curves represented as words in X, see [CL87], [Lus87] and [Tan96]. Most recently, Despre and Lazarus [DL17] have given an algorithm which runs in O(L 2 ) time, where L is a bound on the length of the words representing the curves.
In order to construct a set containing all simple words in X, we recall the Dehn-Thurston parametrisation of simple curves. For a fixed pants decomposition K = {K i } N i=1 of Σ, the Dehn-Thurston coordinate of a simple curve α is defined to be the vector where each m i is the intersection number of α with the pants curve K i , and each t i is a 'twisting parameter' which counts the number of times α traverses each curve K i . We define the combinatorial length of a simple geodesic α, to be the sum Although it is easy to see that the combinatorial length of a curve is comparable to its hyperbolic length, our algorithm requires calculation of explicit bounds. We note that there exist various methods for obtaining such bounds, for instance by quantifying the proof of the Milnor-Svarc Lemma. Here we use a more direct approach: Proposition 1.2. Fix a complete hyperbolic metric on Σ to be so that each pants curve has length 9 10 . For any simple geodesic α in Σ, the combinatorial length of α satisfies l p (α) ≤ 4l h (α).
The final step of our algorithm is to write the curves as words in a generating set X of π 1 (Σ). We construct a specific generating set X which fits our purpose well, and which is closely related to the Dehn-Thurston coordinates (see Section 2.3). Given the bound from Proposition 1.2, we can then construct the required set of simple words of bounded length, thus also proving the following proposition. We say a hyperbolic metric on Σ is admissible, if each pants curve in K has length at most 9 10 . Proposition 1.3. Let Σ be a compact, orientable hyperbolic surface with an admissible hyperbolic metric. For any L > 0, there exists an explicit method of constructing the set W(L), which contains all words corresponding to simple curves of hyperbolic length at most L, and satisfies |W(L)| ≤ 2 N 4L+2N

2N
. This paper is organised as follows. In Section 2 we review the relevant background material, including the Dehn-Thurston coordinates, and explain the dictionary between the coordinates and word representation of curves. In Section 3 we prove the bound between hyperbolic and combinatorial lengths of simple curves from Proposition 1.2. Finally in Section 4 we collect results about filling curves and prove Theorem 1.1.
1.1. Acknowledgements. I would like to express my deepest gratitude to Viveka Erlandsson for her patience, expertise, and passion whilst supervising this undergraduate project. I would also like to thank Juan Souto for his valuable comments on a draft of this paper, and the anonymous referee for the suggested improvements. This work was partially supported by the London Mathematical Society Research Bursary Scheme, Grant Reference 17-18 56.

Background
We describe the Dehn-Thurston coordinates of multiarcs in Σ. Originally attributed to Dehn, the parametrisation was rediscovered by Thurston [Thu88]. We present here a brief overview of the coordinates. For a more detailed account see [PH92].
2.1. Preliminaries. Throughout this paper we let Σ = Σ g,n be a compact, oriented surface with genus g, and n boundary components. Let ∂Σ denote the boundary of Σ, and let {δ 1 , · · · , δ n } be the set of connected components of ∂Σ. We assume that Σ has negative Euler characteristic, and we quip Σ with a complete hyperbolic metric h such that the connected components of ∂Σ (if any) are geodesics. We letΣ denote the universal cover of Σ which, as usual, we identify with a subset of the hyperbolic plane H = {z ∈ C | Im(z) > 0}. We will use the term curve to mean an immersion γ : S 1 → Σ, and arc an immersion α : [0, 1] → Σ such that α(0), α(1) ∈ ∂Σ. We say a curve in Σ is essential if it is not homotopic to a boundary component, nor to a point in Σ. An arc is essential if it cannot be homotoped into the boundary, relative its endpoints. We define a multiarc in Σ to be a finite collection of homotopy classes of simple curves and simple arcs in Σ, which are essential and pairwise disjoint. A multicurve is a multiarc with no arc components. Recall that the homotopy class of any curve γ in Σ contains a unique geodesic. We let l h (γ) denote the length of that unique geodesic. If α is an arc, we write l h (α) to mean the length of a shortest representative in the homotopy class, where the homotopy is relative to ∂Σ. For a multiarc Γ = n i=1 γ i , we define its length l h (Γ) to be the sum l h (Γ) = n i=1 l h (γ i ). We define the (geometric) intersection number of two curves α and β to be Here α ∼ β denotes the existence of homotopy between α and β, where the homotopy is relative to the boundary ∂Σ if α and β are arcs. Note that this definition extends naturally to multiarcs.
We will need the following standard result from hyperbolic geometry (see [Kee74] and [Bus78]). If γ is a simple geodesic curve in a hyperbolic surface Σ, a collar of width w around γ is the set Let w γ be the largest w for which the collar C(w) is an embedded annulus in Σ. The Collar Lemma states that Moreover, for any collection of simple, pairwise disjoint geodesic curves {γ i } in Σ, the corresponding collars C(γ i , w γi ) are pairwise disjoint [Bus10, Theorem 4.1.1].
Let P denote a surface homeomorphic to a sphere with three disks removed, which we will refer to as a pair of pants. For the remainder of this note, we fix a complete hyperbolic metric h on P to be such that each boundary component has length 9 10 . Elementary hyperbolic computations show that the length of each seam s, (the shortest arc joining any two distinct boundary components), in our metric on P satisfies l h (s) ≈ 3.06 and the length of each mid ν, (the shortest essential arc joining a boundary component to itself), satisfies l h (ν) ≈ 4.57. We record these here for later. In what follows, we will refer to the two hexagonal regions in P bounded by the seams and the boundary curves, as faces of P .

Dehn-Thurston coordinates. Fix a pants decomposition
be the corresponding set of pairs of pants. For each pants curve K i , pick a closed subarc w i ⊂ K i called the window of the pants curve, and a point p i ∈ w i called the marked point. For each pair of pants P k ∈ P, and for every pair of (not necessarily distinct) marked points in the boundary of P k , fix a shortest simple oriented arc that is essential in P k , and whose endpoints are the marked points. The resulting set of arcs is called the set of canonical arcs of Σ. For each index k, let A k denote the set of canonical arcs in the pair of pants P k .
Given a multiarc C in Σ, the Dehn-Thurston parameter (m 1 , · · · , m N ) Consider the connected 1-complex in Σ consisting of the pants curves and the canonical arcs. Fix > 0, and isotope C so that it is contained in the -neighbourhood of the 1-complex. If C does not intersect the pants curve The parameter |t i | is defined to be half the minimum intersection of c with the two edges of R i perpendicular to w i , over all arcs c homotopic to c, fixing endpoints. We set the sign of t i to be positive if some strand of C travels to the right of the -neighbourhood of K i (treated as an oriented annulus, with orientation induced from Σ), and negative otherwise.
It follows that every simple curve can be identified with a point in Z N ≥0 ×Z N , and one can show that this point is unique. Conversely, a point in Z N ≥0 ×Z N corresponds to a Dehn-Thurston coordinate of a multicurve, provided that it satisfies a set of simple conditions. We will not need these here, however the interested reader is referred to [PH92]. We only note that it follows that the number of multicurves of combinatorial length at most L is bounded by 2 N 2N +L L , which grows like O(L 2N ).
2.3. Dictionary between coordinates and words. Let π 1 (Σ, p) denote the fundamental group of Σ based at p, and without loss of generality pick p to be a point from the set {p i } of marked points of the pants curves in Σ. Let T be a spanning tree of the 1-complex in Σ consisting of pants curves and canonical arcs (as above). Fix an orientation for each of the pants curve in K. For each index i, let a i be the unique oriented path in the in the spanning tree T from p to p i ∈ K i . Define the oriented loopK i := a i K i a −1 i based at p. For each k and every l ∈ A k , letl denote the corresponding oriented loop based at p, for some fixed orientation, and writẽ A k = {l | l ∈ A k }. Let X = {K i } ∪ Ã k , and note that this set generates π 1 (Σ, p).
Suppose C is a multiarc in Σ. Recall that the Dehn-Thurston coordinate of C is obtained by homotoping C so that it is carried by the 1-complex consisting of pants curves and canonical arcs in Σ. Thus, given the Dehn-Thurston coordinate of C, it is possible to represent C as a concatenation of canonical arcs and pants curves, that is C = u 1 · · · u n where each u l ∈ {K i }∪ A k . For each u l in the decomposition of C, letũ l be the corresponding loop at p (as defined above) and letC =ũ 1 · · ·ũ n be the concatenation of these loops. Since the endpoints of consecutive arcs u l , u l+1 in C coincide, we must have that the arc which connects the endpoint of u l to p and the arc which connects p to the start point of u l+1 cancel out. Thus, Hence, we can identify C with the conjugacy class [ũ 1 · · ·ũ k ] in π 1 (Σ, p), and thus write it as a word in X of length l p (C). As a result, we obtain a dictionary between the Dehn-Thurston coordinates, and words in generators X of π 1 (Σ, p).
For later use, we record here a bound for the hyperbolic length of a curve, in terms of the length of a word in X which represents it. As before, we fix the hyperbolic metric on Σ to be so that each pants curve has length 9 10 . From the calculations at the end of Section 2.1, it follows that the length of each canonical arc joining two distinct pants curves is bounded by 3.1 + 2 9 10 < 5, and the length of canonical arc joining the same boundary component is bounded by 5 + 9 10 < 6. Recall that each edge of the spanning tree T is a canonical arc of Σ. We define the length of T to be the sum of the lengths of the canonical arcs which constitute its edges. It is clear that the spanning tree T can only contain canonical arcs with distinct endpoints, and furthermore T can contain at most 2 arcs from each pair of pants. Thus the length of T is bounded by 10M , where M = 2g − 2 + n is the number of pairs of pants in Σ. Each generator in X has length at most twice the length of T , plus the length of the longest canonical arc, or pants curve. Hence, the length of each generator is bounded by 20M + 6 ≤ 26M . It follows that if γ is any curve in Σ which can be represented as a word of length L in X, then l h (γ) ≤ 26M L.

Bound for the combinatorial length of geodesics
In this section we prove Proposition 1.2 which relates the combinatorial length of a simple curve to its hyperbolic length. The main idea is to first prove bounds relating the combinatorial and hyperbolic lengths of a multiarc in a pair of pants. By applying the bound to segments of the curve in each pair of pants of the pants decomposition of Σ, we extend the result to a bound for a curve in the whole surface.

Multiarcs in pairs of pants. Fix a basis for the Dehn-Thurston parameters by taking the marked points {p
in the boundary of P to be such that they are contained in the same face of P , and the canonical arcs to be the shortest essential arcs joining each pair of marked points. Given a multiarc A and its Dehn-Thurston parametrisation (m 1 , · · · , m N ) × (t 1 , · · · , t N ) ∈ Z N ≥0 × Z N , recall that we defined the combinatorial length of A to be the sum  Claim 1. The bound (3.1) holds for any simple, non-canonical arc a in P with distinct endpoints contained in the set Assume that a has endpoints a(0) = p 1 ∈ δ 1 and a(1) = p 2 ∈ δ 2 , the other cases can be treated analogously. Let a * be the shortest arc that is homotopic to a (fixing endpoints), and which traverses only the boundary components δ 1 , δ 2 and the seam s connecting them. For each index i, let |τ i | be the length of the subarc of a * which traverses the boundary δ i . We set τ i to be positive if a * travels to the right of the boundary component, and negative otherwise.
We first observe that where t 1 , t 2 are the twisting parameters from the Dehn-Thurston parametrisation of a. Indeed, the distance between the marked p i and the endpoint of the seam s in δ i is at most half the length of δ i , for i = 1, 2, and so (3.2) follows from the definition of the twisting parameter. Next, we show that Since l h (δ 1 ) = l h (δ 2 ) = 9 10 and l h (s) > 3l h (δ 1 ), we have that and so by (3.2) we have that 2l h (a) ≥ 9 10 (2 + |t 1 | + |t 2 |) = 9 10 l p (a), as required. In order to prove (3.3) one considers three cases, depending on whether τ 1 τ 2 is positive, negative or zero. All three follow from elementary hyperbolic geometry computations. We prove one of the three cases below, leaving the details of the remaining cases to the reader.
Assume τ 1 τ 2 > 0, and choose lifts of the arcs a, a * to the universal cover of P to be such that the endpoints of the lift of a coincide with the endpoints of the lift of a * . By abuse of notation, we write a, a * to also denote the lifts of the corresponding arcs. Since the seam s 12 intersects the boundary components at right angles, we have that a, a * form the sides of two right triangles. We split a = a 1 + a 2 into two sub-arcs, each of which is the hypotenuse of one of the triangles, see Figure 1. Using elementary result from hyperbolic geometry, we have that l h (a 1 ) ≥ |τ 1 | l h (δ 1 ) and l h (a 2 ) ≥ |τ 2 | l h (δ 2 ). Furthermore, by definition of the seam we must have that l h (a) ≥ l h (s 12 ). The bound in (3.3) follows.
The bound in (3.1) holds for any simple loop a in P based at p.
Proof. Let δ denote the boundary component of P which contains the endpoints of a, and let ν be the mid of P with endpoints in δ, i.e. the the shortest essential arc joining δ to itself. Set a * to be the unique arc of shortest length which is homotopic to a and which traverses only the boundary δ and the mid ν. Since a is simple, it must be that when a * traverses δ for the second time, it is travelling in the opposite direction to the first time. Let |τ + | , |τ − | be the length of the subarc of a * which traverses δ in the positive and negative directions, respectively. Let t denote the twisting parameter a corresponding to the boundary component δ. Clearly, By lifting the arcs a and a * to the universal cover of P as in proof of Claim 1, we get that this time using the fact that the length of the mid satisfies l h (ν) ≈ 4.57 ≥ 4l h (δ). The required result follows by combining (3.4) and (3.5).
The generalisation of Lemma 3.1 to multiarcs in P follows directly by the definition of Dehn-Thurston coordinates: Corollary 3.2. If C is a multiarc in P with endpoints coinciding with the marked points {p i } 3 i=1 ⊂ ∂P , then l p (C) ≤ 20 9 l h (C).
3.2. Proof of Proposition 1.2. Let P = {P i } M i=1 denote the collection of pairs of pants in the pants decomposition K = {K 1 , · · · , K N } of Σ from before. Fix a complete hyperbolic metric h on Σ to be such that the length of each pants curve is 9 10 . Fix the set of marked points {p i } N i=1 in the pants curves, and the set of canonical arcs connecting them, as before.
Proof of Proposition 1.2. Let α be a simple geodesic curve. For each j such that ι(α, K j ) = 0, homotope α in a small neighbourhood of K j so that it intersects K j exactly at the marked point p j , and so that the resulting curve only self-intersects at the marked points. Let α * be the curve obtained via this homotopy, and for every j let α j = α * ∩ P j . We define the pants length of α * to be where each l h (α j ) is understood to be the hyperbolic length of the multiarc α j in P j . We aim to find a constant c > 0 such that l h,K (α * ) ≤ c l h (α).
By the triangle inequality, l h (α j ) ≤ l h (α ∩ P j ) + l h (K)ι(α, ∂P j ) for every j, where K is any pants curve in K (the pants curves all have the same length). Also M j=1 ι(α, ∂P j ) = 2ι(α, K), and M j=1 l h (α ∩ P j ) ≤ l h (α), since α is a geodesic. Hence l h,K (α * ) ≤ l h (α) + 2l h (K)ι(α, K). By the Collar Lemma, there exists a constant w(K) = arcsinh(1/ sinh( l h (K) 2 )), such that we can embed an annulus of width 2w around every pants curve in Σ, with the property that the annuli are pairwise disjoint. Thus, at each intersection of α with some pants curve K j , we must have that α traverses at least the width of the annular neighbourhood around K j . Hence, we have that ι(α, K) ≤ l h (α) 2w . Putting everything together, where the second inequality follows from noting that l h (K) = 9 10 , so w(K) = arcsinh(1/ sinh( l h (K) 2 )) ≥ 3/2 and thus 1 + l h (K) w ≤ 8 5 . Finally, we relate the combinatorial length of α to the sum of the combinatorial lengths of the multiarcs α j ⊂ P j for 1 ≤ j ≤ M . Let p(α j ) = (m j 1 , m j 2 , m j 3 ) × (t j 1 , t j 2 , t j 3 ) be the Dehn-Thurston coordinate for the multiarc α j in P j . If we cut α * and consider the intersections of the multiarcs {α 1 , · · · , α M } with the boundaries of the pairs of pants they're contained in, each intersection of α * with a pants curve in K gives rise to exactly two intersections, and conversely every intersection of α i with the boundary of a pair of pants arises in this way. (Note that this is because α * does not intersect the boundary curves of Σ.) Furthermore, suppose two pairs of pants P j , P k intersect at a common boundary which corresponds to the pants curve K i , and t i is the twisting parameter of α around K i . Take α j ⊂ P j , α k ⊂ P k , and let t j , t k be their respective twisting parameters around the pants legs corresponding to K i . Then the twisting parameters satisfy |t i | = |t j + t k | ≤ |t j | + |t k |. It follows that l p (α * ) ≤ M i=1 l p (α j ). By the above remarks and Corollary 3.2, l h (α l ) = 20 9 l h,K (α * ).
Combining this with (3.6), we get that

Algorithm for filling curves
4.1. Filling curves. Recall that a curve γ ⊂ Σ in minimal position is filling, if the components of Σ − γ are topological disks and annuli, such that each annulus is homotopic to a boundary component of Σ. Equivalently, γ is filling if and only if it intersects every essential simple curve in Σ. In fact the following stronger result holds, whose proof we include below for completeness.
Lemma 4.1. Fix a hyperbolic metric h on Σ, and let γ be a non-peripheral closed geodesic in Σ. Then, the geodesic γ is filling if and only if it intersects every essential simple closed curve α in Σ, with l h (α) ≤ 2 h (γ).
We define an essential subsurface of a curve γ, denoted Σ γ , to be the smallest subsurface of Σ which contains γ, such that every component of ∂Σ γ is either contained in ∂Σ, or is an essential, simple curve in Σ.
Proof of Lemma 4.1. The forward direction is clear.
For the other direction, let γ be a closed geodesic in Σ and suppose γ does not fill Σ. Let {γ 1 , · · · , γ k } be the geodesic boundary curves of the essential surface Σ γ . We claim that k i=1 l h (γ i ) ≤ 2l h (γ). Indeed, since γ fills Σ γ the complement Σ γ − γ is a set of pairwise-disjoint disks and annuli. Each γ i acts as a boundary component of exactly one annulus in the decomposition, whilst the other boundary is a concatenation of segments of γ which are homotopic to γ i . The segments of γ can act as the boundary of at must two annuli, and thus the bound of the claim follows. Since γ does not intersect any of the curves in {γ 1 , · · · , γ k }, the result follows from the claim.

4.2.
Algorithm for curve intersection. By Lemma 4.1, in order to determine whether a curve γ is filling, one needs to compute the intersection number of γ with a finite collection of curves. There exists a number of algorithms for computing intersection numbers, taking as input curves in various combinatorial representations. The work of Tan [Tan96], and Cohen and Lustig [CL87] gives algorithms for curves represented as words in a generating set of the fundamental group, for surfaces with nonempty boundary. The latter algorithm was extended by Lustig [Lus87] to also deal with the closed surface case.
More recently, Despré and Lazarus [DL17] have constructed another such algorithm, which is of particular interest to us as it gives estimates for its running time. Given two curves represented as walks of length at most L in an embedded graph in the surface Σ, the algorithm computes their intersection number in O(L 2 ) time. We note that given our generating set X (see Section 2.3), we can construct an embedded graph in Σ in the following way. The set X gives rise to an immersed graph with a single vertex p, and an edge for each generator. Homotoping each generator curve (fixing base point p) so that the curves are in minimal position, we add a vertex at each intersection point. Now each generator in X corresponds to a walk of length at most c, where c is some fixed constant depending only on the complexity of the surface. Thus a word in X of length bounded by L corresponds to a closed walk of length bounded by cL.
We summarise the preceding discussion with the following theorem: Theorem 4.2 (Cohen-Lustig [CL87], Lustig [Lus87], Tan [Tan96], Despré-Lazarus [DL17]). Let Σ be a surface of negative Euler characteristic. There exists an algorithm to determine whether two curves represented as words have non-zero geometric intersection. Furthermore, if the words which represent the curves have length at most L, the algorithm terminates in O(L 2 ) time.

4.3.
Proof of the main result. We now prove the main results of the paper. Along the way we also prove Proposition 1.3.
Proof of Theorem 1.1. Fix a pants decomposition of Σ, and a complete hyperbolic metric h where each pants curve has length 9 10 . Fix the generating set X of π 1 (Σ), as before. Let γ be a curve in Σ, represented as a word x γ in X of length L. From the calculations in Section 2.3, l h (γ) ≤ 26M L = L , where M = 2g − 2 + n is the number of pairs of pants in Σ.
Let C = C(8L ) denote the set of Dehn-Thurston coordinates of curves of combinatorial length bounded by 8L . By Theorem 1.2, C contains all simple curves of hyperbolic length bounded by 2L . Using the dictionary given in Section 2.3, translate the Dehn-Thurston coordinates into words in X, and let W(L ) denote the resulting set of words. Using Theorem 4.2, one checks the geometric intersection number of x γ with each of the words in W(L ). If there exists a word in W(L ) which does not intersect x γ , then by Lemma 4.1 γ is not filling. Otherwise, γ is filling.
To see that this procedure terminates in polynomial time, note that W(L ) contains at most 2 N 8L +2N