# End (graph theory)

In the mathematics of infinite graphs, an end of a graph represents, intuitively, a direction in which the graph extends to infinity. Ends may be formalized mathematically as equivalence classes of infinite paths, as havens describing strategies for pursuit–evasion games on the graph, or (in the case of locally finite graphs) as topological ends of topological spaces associated with the graph.
Ends of graphs may be used (via Cayley graphs) to define ends of finitely generated groups. Finitely generated infinite groups have one, two, or infinitely many ends, and the Stallings theorem about ends of groups provides a decomposition for groups with more than one end.

## Definition and characterization

Ends of graphs were defined by Rudolf Halin (1964) in terms of equivalence classes of infinite paths. A ray in an infinite graph is a semi-infinite simple path; that is, it is an infinite sequence of vertices $v_{0},v_{1},v_{2},\dots$ in which each vertex appears at most once in the sequence and each two consecutive vertices in the sequence are the two endpoints of an edge in the graph. According to Halin's definition, two rays $r_{0}$ and $r_{1}$ are equivalent if there is a ray $r_{2}$ (which may equal one of the two given rays) that contains infinitely many of the vertices in each of $r_{0}$ and $r_{1}$. This is an equivalence relation: each ray is equivalent to itself, the definition is symmetric with regard to the ordering of the two rays, and it can be shown to be transitive. Therefore, it partitions the set of all rays into equivalence classes, and Halin defined an end as one of these equivalence classes.
An alternative definition of the same equivalence relation has also been used: two rays $r_{0}$ and $r_{1}$ are equivalent if there is no finite set $X$ of vertices that separates infinitely many vertices of $r_{0}$ from infinitely many vertices of $r_{1}$. This is equivalent to Halin's definition: if the ray $r_{2}$ from Halin's definition exists, then any separator must contain infinitely many points of $r_{2}$ and therefore cannot be finite, and conversely if $r_{2}$ does not exist then a path that alternates between $r_{0}$ and $r_{1}$ until no more alternations are possible must form the desired finite separator.
Ends also have a more concrete characterization in terms of havens, functions that describe evasion strategies for pursuit–evasion games on a graph $G$. In the game in question, a robber is trying to evade a set of policemen by moving from vertex to vertex along the edges of $G$. The police have helicopters and therefore do not need to follow the edges; however the robber can see the police coming and can choose where to move next before the helicopters land. A haven is a function $\beta$ that maps each set $X$ of police locations to one of the connected components of the subgraph formed by deleting $X$; a robber can evade the police by moving in each round of the game to a vertex within this component. Havens must satisfy a consistency property (corresponding to the requirement that the robber cannot move through vertices on which police have already landed): if $X$ is a subset of $Y$, and both $X$ and $Y$ are valid sets of locations for the given set of police, then $\beta (X)$ must be a superset of $\beta (Y)$. A haven has order $k$ if the collection of police locations for which it provides an escape strategy includes all subsets of fewer than $k$ vertices in the graph; in particular, it has order $\aleph _{0}$ (the smallest aleph number) if it maps every finite subset $X$ of vertices to a component of $G\setminus X$. Every ray in $G$ corresponds to a haven of order $\aleph _{0}$, namely, the function $\beta$; that maps every finite set $X$ to the unique component of $G\setminus X$ that contains infinitely many vertices of the ray. Conversely, every haven of order $\aleph _{0}$ can be defined in this way by a ray. Two rays are equivalent if and only if they define the same haven, so the ends of a graph are in one-to-one correspondence with its havens of order $\aleph _{0}$.

## Examples

If the infinite graph $G$ is itself a ray, then it has infinitely many ray subgraphs, one starting from each vertex of $G$. However, all of these rays are equivalent to each other, so $G$ only has one end.
If $G$ is a forest (that is, a graph with no finite cycles), then the intersection of any two rays is either a path or a ray; two rays are equivalent if their intersection is a ray. If a base vertex is chosen in each connected component of $G$, then each end of $G$ contains a unique ray starting from one of the base vertices, so the ends may be placed in one-to-one correspondence with these canonical rays. Every countable graph $G$ has a spanning forest with the same set of ends as $G$. However, there exist uncountably infinite graphs with only one end in which every spanning tree has infinitely many ends.
If $G$ is an infinite grid graph, then it has many rays, and arbitrarily large sets of vertex-disjoint rays. However, it has only one end. This may be seen most easily using the characterization of ends in terms of havens: the removal of any finite set of vertices leaves exactly one infinite connected component, so there is only one haven (the one that maps each finite set to the unique infinite connected component).

## Relation to topological ends

In point-set topology, there is a concept of an end that is similar to, but not quite the same as, the concept of an end in graph theory, dating back much earlier to Freudenthal (1931). If a topological space can be covered by a nested sequence of compact sets $\kappa _{0}\subset \kappa _{1}\subset \kappa _{2}\dots$, then an end of the space is a sequence of components $U_{0}\supset U_{1}\supset U_{2}\dots$ of the complements of the compact sets. This definition does not depend on the choice of the compact sets: the ends defined by one such choice may be placed in one-to-one correspondence with the ends defined by any other choice.
An infinite graph $G$ may be made into a topological space in two different but related ways:
* Replacing each vertex of the graph by a point and each edge of the graph by an open unit interval produces a Hausdorff space from the graph in which a set $S$ is defined to be open whenever each intersection of $S$ with an edge of the graph is an open subset of the unit interval.
* Replacing each vertex of the graph by a point and each edge of the graph by a point produces a non-Hausdorff space in which the open sets are the sets $S$ with the property that, if a vertex $v$ of $G$ belongs to $S$, then so does every edge having $v$ as one of its endpoints.
In either case, every finite subgraph of $G$ corresponds to a compact subspace of the topological space, and every compact subspace corresponds to a finite subgraph together with, in the Hausdorff case, finitely many compact proper subsets of edges. Thus, a graph may be covered by a nested sequence of compact sets if and only if it is locally finite, having a finite number of edges at every vertex.
If a graph $G$ is connected and locally finite, then it has a compact cover in which the set $\kappa _{i}$ is the set of vertices at distance at most $i$ from some arbitrarily chosen starting vertex. In this case any haven $\beta$ defines an end of the topological space in which $U_{i}=\beta (\kappa _{i})$. And conversely, if $U_{0}\supset U_{1}\supset U_{2}\dots$ is an end of the topological space defined from $G$, it defines a haven in which $\beta (X)$ is the component containing $U_{i}$, where $i$ is any number large enough that $\kappa _{i}$ contains $X$. Thus, for connected and locally finite graphs, the topological ends are in one-to-one correspondence with the graph-theoretic ends.
For graphs that may not be locally finite, it is still possible to define a topological space from the graph and its ends. This space can be represented as a metric space if and only if the graph has a normal spanning tree, a rooted spanning tree such that each graph edge connects an ancestor-descendant pair. If a normal spanning tree exists, it has the same set of ends as the given graph: each end of the graph must contain exactly one infinite path in the tree.

## Special kinds of ends
### Free ends

An end $E$ of a graph $G$ is defined to be a free end if there is a finite set $X$ of vertices with the property that $X$ separates $E$ from all other ends of the graph. (That is, in terms of havens, $\beta _{E}(X)$ is disjoint from $\beta _{D}(X)$ for every other end $D$.) In a graph with finitely many ends, every end must be free. Halin (1964) proves that, if $G$ has infinitely many ends, then either there exists an end that is not free, or there exists an infinite family of rays that share a common starting vertex and are otherwise disjoint from each other.

### Thick ends

A thick end of a graph $G$ is an end that contains infinitely many pairwise-disjoint rays. Halin's grid theorem characterizes the graphs that contain thick ends: they are exactly the graphs that have a subdivision of the hexagonal tiling as a subgraph.

## Special kinds of graphs
### Symmetric and almost-symmetric graphs

Mohar (1991) defines a connected locally finite graph to be "almost symmetric" if there exist a vertex $v$ and a number $D$ such that, for every other vertex $w$, there is an automorphism of the graph for which the image of $v$ is within distance $D$ of $w$; equivalently, a connected locally finite graph is almost symmetric if its automorphism group has finitely many orbits. As he shows, for every connected locally finite almost-symmetric graph, the number of ends is either at most two or uncountable; if it is uncountable, the ends have the topology of a Cantor set. Additionally, Mohar shows that the number of ends controls the Cheeger constant $h=\inf \left\{{\frac {|\partial V|}{|V|}}\right\},$ where $V$ ranges over all finite nonempty sets of vertices of the graph and where $\partial V$ denotes the set of edges with one endpoint in $V$. For almost-symmetric graphs with uncountably many ends, $h>0$; however, for almost-symmetric graphs with only two ends, $h=0$.

### Cayley graphs

Every group and a set of generators for the group determine a Cayley graph, a graph whose vertices are the group elements and the edges are pairs of elements $(x,gx)$ where $g$ is one of the generators. In the case of a finitely generated group, the ends of the group are defined to be the ends of the Cayley graph for the finite set of generators; this definition is invariant under the choice of generators, in the sense that if two different finite set of generators are chosen, the ends of the two Cayley graphs are in one-to-one correspondence with each other.
For instance, every free group has a Cayley graph (for its free generators) that is a tree. The free group on one generator has a doubly infinite path as its Cayley graph, with two ends. Every other free group has infinitely many ends.
Every finitely generated infinite group has either 1, 2, or infinitely many ends, and the Stallings theorem about ends of groups provides a decomposition of groups with more than one end. In particular:
* A finitely generated infinite group has 2 ends if and only if it has a cyclic subgroup of finite index.
* A finitely generated infinite group has infinitely many ends if and only if it is either a nontrivial free product with amalgamation or HNN-extension with finite amalgamation.
* All other finitely generated infinite groups have exactly one end.