# An Implementation of the Bestvina-Handel Algorithm for Surface Homeomorphisms

## 1 Introduction

The fundamental group of a surface $`S`$ of genus $`g`$ with one puncture is a free group $`F`$ on $`2g`$ generators. A homeomorphism of $`S`$ induces an outer automorphism $`𝒪`$ of $`F`$, and we can represent $`𝒪`$ as a homotopy equivalence $`f:GG`$ of a finite graph $`GS`$ homotopy equivalent to $`S`$.

$`f:GG`$ is said to be a train track map if for every $`n1`$ and for every edge $`e`$ of $`G`$, the restriction of $`f^n`$ to the interior of $`e`$ is an immersion. In \[BH95\], Bestvina and Handel give an effective algorithm that takes a homotopy equivalence $`f:GG`$ representing an outer automorphism $`𝒪`$ and attempts to find a train track representative $`f^{}:G^{}G^{}`$ of $`𝒪`$, where $`G^{}`$, like $`G`$, is embedded in and homotopy equivalent to $`S`$. If $`𝒪`$ is irreducible<sup>1</sup><sup>1</sup>1See \[BH92\] for a definition of irreducibility. For our purposes, it is sufficient to know that an outer automorphism induced by a pseudo-Anosov homeomorphism of a surface with one puncture will always be irreducible., the algorithm will always succeed. If $`𝒪`$ is reducible, it will either find a train track representative, or it will conclude that $`𝒪`$ is reducible.

Given a train track representative $`f:GG`$ of an outer automorphism induced by a surface homeomorphism $`\varphi :SS`$, Bestvina and Handel (see \[BH95\]) construct a so-called train track<sup>2</sup><sup>2</sup>2Thurston’s notion of train tracks is slightly different from the notion of train tracks according to Bestvina and Handel. For an exposition of Thurston’s theory of surface homeomorphisms, see \[FLP79\]. $`\tau `$, which can be thought of as being embedded in $`S`$. Using $`\tau `$, one can effectively decide whether $`\varphi `$ is pseudo-Anosov. Furthermore, in the pseudo-Anosov case, the following information can be extracted from $`\tau `$ and $`f`$:

* the growth rate of $`\varphi `$
* the structure of the stable and unstable foliations of $`\varphi `$, in particular singular points of the foliations and their indices

The software package implements this theory in the case of surfaces of genus at least two with exactly one puncture. This restriction is motivated by the fact pseudo-Anosov homeomorphisms of surfaces with one puncture induce irreducible automorphisms of the fundamental group. This is not true for surfaces with more than one puncture, and handling this case would require the implementation of a more complicated algorithm. However, the theory developed in \[BH95\] works in full generality (including the case of closed surfaces, which can be reduced to the case of punctured surfaces by removing the orbit of a periodic point).

The package consists of three main parts:

* The first part takes a surface homeomorphism $`\varphi :SS`$ defined by a sequence of Dehn twists and turns it into a homotopy equivalence of a graph.
* The second part takes a homotopy equivalence of a graph and either finds a reduction or a train track representative.
* The third part constructs a train track $`\tau `$ from a train track representative and generates an image of $`\tau `$ embedded in the surface $`S`$.

The output of the second and third part combined contain all the information about $`\varphi `$ listed above. In particular, they decide whether $`\varphi `$ is pseudo-Anosov.

The package is highly modular, and the three parts can be used independently. For example, the handling of Dehn twists has applications beyond the scope of this paper, and the second part also works for nongeometric outer automorphisms of free groups (see \[BH92\]). Moreover, each of the three parts falls into several functional units, many of which (such as computations and graphics in the hyperbolic plane) may be used in other contexts.

The implementation of the train track algorithm is a part of my master’s thesis (\[Bri95\]); the design and implementation of the programs handling Dehn twists and graphics is a part of my Diplom thesis (\[Bri96\]). It is my pleasure to express my gratitude to Klaus Johannson and Werner Ballmann for their help in writing my theses in Knoxville, Paris and Bonn. I would like to thank Steve Gersten for encouraging me to write this article. Finally, I would like to thank the editors and the referees for valuable suggestions.

The software package, written in Java, is available free of charge at http://www.math.utah.edu/~brinkman. An older version of the package, written in ANSI-C, is also available. Both versions are portable and should run on most systems.

## 2 Related algorithms and implementations

There are at three least other implementations of the Bestvina-Handel algorithm, each with an emphasis different from the implementation described here.

* T. White’s ”FOLDTOOL” (\[Whi90\]) is an implementation of the train track algorithm from \[BH92\] for free groups. Automorphisms are entered and displayed as homotopy equivalences of graphs.
* B. Menasco and J. Ringland (see \[MR96\]) have implemented the Bestvina-Handel algorithm in the case of automorphisms of punctured spheres. Homeomorphisms can be entered as braid words or as homotopy equivalences of graphs. Results are displayed as homotopy equivalences of graphs.
* T. Hall’s implementation (see \[Hal96\]) handles arbitrary punctured surfaces. Homeomorphisms are entered as homotopy equivalences of graphs, as braid words, or as horseshoe maps according to Smale. Results are displayed as homotopy equivalences of graphs.

A common characteristic of all implementations is a program realizing some part of the theory developed in \[BH92, BH95\]. The main distinguishing characteristic of the implementation discussed here is that homeomorphisms of surfaces with one puncture can be entered as compositions of Dehn twists, and results can be displayed as pictures of graphs embedded in surfaces, which significantly facilitates the generation of examples as well as the interpretation of results. Hence, the software described here provides a powerful yet easy-to-use environment for mathematical experimentation.

Finally, we note that various authors have found independent approaches to train tracks, e. g., M. Lustig in \[Lus92\], J. Los in \[Los93\] and J. Franks/M. Misiurewicz in \[FM93\]. In \[Lus92\], train tracks are used to study automorphisms of free groups, while the other two papers are concerned with homeomorphisms of punctured spheres.

## 3 Dehn twists

The software package contains a class with two methods for handling Dehn twists: One of them is extremely easy to use and allows the user to define surface homeomorphisms as a composition of Dehn twists with respect to a fixed set of curves (see figure 1). The Dehn twists with respect to this set of curves generate the mapping class group (see \[Lic64\]). This set of generators is not minimal; rather, it was chosen with the user’s convenience in mind.

The other method for handling Dehn twists removes the restriction to a fixed set of curves, which results in a slightly more complicated input format. This method is the part of the package that provides the link between surface homeomorphisms and homotopy equivalences of graphs; the method described in the previous paragraph merely generates input for the second one.

When computing Dehn twists, we adopt the following convention: We equip the surface with an outward pointing normal vector field. When twisting with respect to a curve $`c`$, we turn right<sup>3</sup><sup>3</sup>3The notion of turning left or right is defined with respect to the chosen normal vector field. whenever we hit $`c`$.

## 4 Examples

Figures 2, 3, 4 and 5 were generated by the software package. Each of them shows a train track belonging to a pseudo-Anosov homeomorphism of a once punctured surface of genus 2 or 3. The identification pattern on the boundary of the polygons is given by matching labels of edges intersecting the boundary, and the puncture corresponds to the vertices of the polygon.

Singularities of the stable or unstable foliation of the pseudo-Anosov map in question correspond either to the puncture or to shaded areas containing at least three edges. If a shaded area contains $`k3`$ edges, it gives rise to a singularity of index $`1\frac{k}{2}`$. For the proofs of these statements, see \[BH95\].

Since the sum of the indices of all singularities equals the Euler characteristic of the surface with the puncture closed, we can compute the index of the singularity at the puncture, if any. Moreover, the singularities of the two foliations are fixed points or periodic points of the pseudo-Anosov homeomorphism in question. There are more periodic points than just the singularities of the foliations — in fact, the set of periodic points of a pseudo-Anosov homeomorphism is dense, see \[FLP79, exposé 9, proposition 18\].

In the following examples, $`S_g`$ is a surface of genus $`g`$ with one puncture, and $`D_c`$ denotes the Dehn twist with respect to a curve $`c`$, which will always be one of the curves from figure 1. All the results in the following paragraphs were computed by the software package, the only input being the genus of the surface and a sequence of Dehn twists.

###### Example 4.1 (Maximal index I).

Consider the map $`h:S_2S_2,`$

$$h=D_{a_1}D_{c_0}D_{d_0}D_{a_1}D_{d_1}D_{a_1}.$$

Using the algorithm from \[BH95\], the software concludes that $`h`$ is a pseudo-Anosov homeomorphism with growth rate $`\lambda 1.722084`$. A train track for $`h`$ is shown in figure 2. None of the shaded areas gives rise to a singularity of the stable or unstable foliation, so the puncture is the only singularity, and its index is $`2`$.

###### Example 4.2 (Maximal index II).

Let $`h:S_2S_2`$ be given by

$$h=D_{a_1}^1D_{d_1}D_{c_0}^1D_{d_0}.$$

$`h`$ is a pseudo-Anosov homeomorphism with growth rate $`\lambda 4.390257`$. Figure 3 shows the corresponding train track. The unique shaded area in figure 3 contains six edges, so it gives rise to a singularity $`p`$ of index $`2`$. We conclude that there is no singularity at the puncture.

###### Example 4.3 (Minimal index).

Let the homeomorphism $`h:S_2S_2`$ be given by

$$h=D_{a_0}D_{c_0}^1D_{d_0}D_{d_1}^1.$$

$`h`$ is a pseudo-Anosov homeomorphism with growth rate $`\lambda 2.015357`$. Figure 4 shows the corresponding train track. The shaded areas labeled $`0,1,3,4`$ give rise to singularities of index $`\frac{1}{2}`$, which shows that there is no singularity at the puncture. The singularities $`0`$ and $`4`$ as well as $`1`$ and $`3`$ are exchanged by $`h`$.

###### Example 4.4 (Genus 3).

Let $`h:S_3S_3`$ be given by

$$h=D_{d_0}D_{c_0}D_{d_1}D_{c_1}D_{d_2}D_{c_2}^1.$$

$`h`$ is a pseudo-Anosov homeomorphism with growth rate $`\lambda 2.042491`$. Figure 5 shows the corresponding train track. The shaded areas labeled $`0,2`$ give rise to singularities of index $`2`$, and they are exchanged by $`h`$. There is no singularity at the puncture.

###### Example 4.5 (A reducible example).

Finally, consider $`h:S_2S_2`$ defined by

$$h=D_{d_0}D_{c_0}D_{d_1}.$$

$`h`$ is reducible since the complement of the curves $`d_0`$, $`c_0`$, and $`d_1`$ is not a (punctured) disc, and in fact the software reaches the same conclusion.

## 5 Implementation

The complete online documentation of the software package, including a user manual and the source code, can be found at http://www.math.utah.edu/ ~brinkman, so at this point we restrict ourselves to a brief discussion of the main implementation issues. For the most part, we take the point of view of mathematics rather than that of computer science.

### 5.1 Encoding of embeddings

For the rest of this discussion, it will be advantageous to think of punctures as being distinguished points of closed surfaces. Given a closed surface $`S`$ with a distinguished point $`p`$ and a finite graph $`GS`$ homotopy equivalent to $`S\{p\}`$, we need an efficient way of encoding the embedding of $`G`$ in $`S`$. To this end, consider a loop $`\rho ^{}`$ around $`p`$. $`\rho ^{}`$ is homotopic to a closed edge path $`\rho `$ in $`G`$ that crosses every edge of $`G`$ twice, once for each direction (assuming that $`G`$ has no vertices of valence one). Conversely, given $`G`$ and $`\rho `$, we can reconstruct $`S`$: We simply take a polygon $`P`$ with $`2n`$ sides, where $`n`$ is the number of edges of $`G`$, and interpret $`\rho `$ as an identification pattern on the boundary of $`P`$. Moreover, we can triangulate $`P`$ (and hence $`S`$) by fixing a point $`p`$ in the interior of $`P`$ and connecting $`p`$ to all the vertices in the boundary of $`P`$. Hence, we see that $`G`$ and $`\rho `$ give us an efficient way of encoding the embedding of $`G`$ in $`S`$ along with a triangulation of $`S`$.

### 5.2 Finding a metric

Now, given a triangulation $`\tau `$ of $`S`$, we want to find a hyperbolic metric on $`S`$ with the property that the edges of $`\tau `$ are geodesic segments. There are various ways to accomplish this (see \[CdV91\]); our method of choice is a special case of Thurston’s circle packing (see \[Thu78\]): Given a surface $`S`$ with a hyperbolic metric $`\mu `$ and with a triangulation $`\tau `$ whose edges are geodesic segments, there is a collection of circles centered at the vertices of $`\tau `$ such that no two circles intersect transversally and two vertices of $`\tau `$ are connected by an edge if and only if their corresponding circles are tangent. For each triangulation, there exists exactly one such set of circles, and their radii can be computed numerically. Moreover, they uniquely determine $`\mu `$. Hence, circle packing gives us an effective way of drawing $`S`$ as a polygon (with identifications on the boundary) in the hyperbolic plane.

### 5.3 Philosophy

The package takes advantage of many features of the object-oriented paradigm, such as data encapsulation and reusability. For example, the class that implements maps of graphs does not allow direct access to its contents; the other parts of the package operate on such maps through a small and well defined set of methods, which results in ease of maintenance and great flexibility.

At this time, one general drawback of Java is that many web browsers use faulty implementations of the Java libraries, which may cause problems when running the software described in this article. However, such problems do not occur when the software is run by the Sun appletviewer, which is available for most systems.

The mathematical part of the package consists of 16 classes, reflecting increasing levels of specialization. Some of them, like the implementation of the train track algorithm from \[BH92\], will only be used in the context of this package. Others, like the collection of methods for computations and drawings in the hyperbolic plane, have been designed with other uses in mind. In fact, the package presented here does not even use all the methods defined in this collection.

Finally, the classes and methods handling maps of graphs may be useful beyond the context of this article. For example, the author has already used them for a tentative implementation of some of the algorithms in \[Sta83\].

Department of Mathematics, University of Utah   
Salt Lake City, UT 84112, USA   

E-mail: brinkman@math.utah.edu