## Formal Introduction to Trees

Getting a good grasp of the definition of a tree and of its components is essential to understanding and making good use of them.

**10.1.1 Definition**

What distinguishes trees from other types of graphs is the absence of certain paths called cycles. Recall that a path is a sequence of consecutive edges in a graph, and a circuit is a path that begins and ends at the same vertex.

**Definition 10.1.1 Cycle. **A cycle is a circuit whose edge list contains no duplicates. It is customary to use *C** _{n} *to denote a cycle with

*n*edges.

The simplest example of a cycle in an undirected graph is a pair of vertices with two edges connecting them. Since trees are cycle-free, we can rule out all multigraphs having at least one pair of vertices connected with two or more edges from consideration as trees.

Trees can either be undirected or directed graphs. We will concentrate on the undirected variety in this chapter.

**Definition 10.1.2 Tree. **An undirected graph is a tree if it is connected and contains no cycles or self-loops.

**Example 10.1.3 Some trees ****and non-trees.**

**Figure 10.1.4 **Some trees and some non-trees

(a) Graphs i, ii and iii in Figure 10.1.4 are all trees, while graphs iv, v, and vi are not trees.

(b) A *K*_{2} is a tree. However, if *n *≥ 3, a *K** _{n} *is not a tree.

(c) In a loose sense, a botanical tree is a mathematical tree. There are usually no cycles in the branch structure of a botanical tree.

(d) The structures of some chemical compounds are modeled by a tree. For example, butane Figure 10.1.5 consists of four carbon atoms and ten hydrogen atoms, where an edge between two atoms represents a bond be- tween them. A bond is a force that keeps two atoms together. The same set of atoms can be linked together in a different tree structure to give us the compound isobutane Figure 10.1.6. There are some compounds whose graphs are not trees. One example is benzene Figure 10.1.7.

One type of graph that is not a tree, but is closely related, is a forest.

**Definition 10.1.8 Forest. **A forest is an undirected graph whose components are all trees. ♢

**Example 10.1.9 ****A forest. **The top half of Figure 10.1.4 can be viewed as a forest of three trees. Graph (vi) in this figure is also a forest.

**10.1.2 Conditions ****for a graph to be a tree**

We will now examine several conditions that are equivalent to the one that defines a tree. The following theorem will be used as a tool in proving that the conditions are equivalent.

**Lemma 10.1.10 ***L**et G *= (*V, E*) *be an undirected graph with no self-loops, and let v*_{a}*, v** _{b} *∈

*V . If two different simple paths exist between v*

_{a}*and v*

_{b}*,*

*then there exists a cycle in G.*

*Proof. *Let *p*_{1} = (*e*_{1}*, e*_{2}*, . . . , e** _{m}*) and

*p*

_{2}= (

*f*

_{1}

*, f*

_{2}

*, . . . , f*

*) be two different simple paths from*

_{n}*v*

*a*to

*v*

*b*. The first step we will take is to delete from

*p*

_{1}and

*p*

_{2}the initial edges that are identical. That is, if

*e*

_{1}=

*f*

_{1},

*e*

_{2}=

*f*

_{2}

*, . . .*,

*e*

*=*

_{j }*f*

*, and*

_{j}*e*

_{j }_{+ 1}≠

*f*

_{j }_{+ 1}delete the first

*j*edges of both paths. Once this is done, both paths start at the same vertex, call it

*v*

*, and both still end at*

_{c}*v*

*. Now we construct a cycle by starting at*

_{b}*v*

*and following what is left of*

_{c}*p*

_{1}until we first meet what is left of

*p*

_{2}. If this first meeting occurs at vertex

*v*

*, then the remainder of the cycle is completed by following the portion of the reverse of*

_{d}*p*

_{2}that starts at

*v*

*and ends at*

_{d}*v*

*.*

_{c}

**Theorem 10.1.11 Equivalent Conditions ****for a Graph to be a Tree. ***L**et G *= (*V, E*) *be an undirected graph with no self-loops and *|*V*| = *n. The fol lowing are all equivalent:*

*(1) G is a tree.*

*(2) For each pair of distinct vertices in V , there exists a unique simple path between them.*

*(3) G is connected, and if e *∈ *E**, then **(**V, E **− {**e**}**)* *is disconnected.*

*(4) G contains no cycles, but by adding one edge, you create a cycle*

*(5) G is connected and *|*E*| = *n **− *1*.*

*Proof. *Proof Strategy. Most of this theorem can be proven by proving the

following chain of implications: (1) ⇒ (2), (2) ⇒ (3), (3) ⇒ (4), and (4) ⇒ (1). Once these implications have been demonstrated, the transitive closure of ⇒ on 1 *, *2*, *3*, *4 establishes the equivalence of the first four conditions. The proof that Statement 5 is equivalent to the first four can be done by induction, which we will leave to the reader.

(1) ⇒ (2) (Indirect). Assume that *G *is a tree and that there exists a pair of vertices between which there is either no path or there are at least two distinct paths. Both of these possibilities contradict the premise that *G *is a tree. If no path exists, *G *is disconnected, and if two paths exist, a cycle can be obtained by Theorem 10.1.11.

(2) ⇒ (3). We now use Statement 2 as a premise. Since each pair of vertices in *V *are connected by exactly one path, *G *is connected. Now if we select any edge *e *in *E* , it connects two vertices, *v*_{1} and *v*_{2}. By (2), there is no simple path connecting *v* _{1} to *v*_{2} other than *e*. Therefore, no path at all can exist between *v*_{1} and *v*_{2 }in (*V, E * *− * {*e*}). Hence (*V, E * *− * {*e*}) is disconnected.

(3) ⇒ (4). Now we will assume that Statement 3 is true. We must show that *G *has no cycles and that adding an edge to *G *creates a cycle. We will use an indirect proof for this part. Since (4) is a conjunction, by DeMorgan's Law its negation is a disjunction and we must consider two cases. First, suppose that *G *has a cycle. Then the deletion of any edge in the cycle keeps the graph connected, which contradicts (3). The second case is that the addition of an edge to *G *does not create a cycle. Then there are two distinct paths between the vertices that the new edge connects. By Lemma 10.1.10, a cycle can then be created, which is a contradiction.

(4) ⇒ (1) Assume that *G *contains no cycles and that the addition of an edge creates a cycle. All that we need to prove to verify that *G *is a tree is that *G *is connected. If it is not connected, then select any two vertices that are not connected. If we add an edge to connect them, the fact that a cycle is created implies that a second path between the two vertices can be found which is in the original graph, which is a contradiction.

The usual definition of a directed tree is based on whether the associated undirected graph, which is created by "erasing" its directional arrows, is a tree. In Section 10.3 we will introduce the rooted tree, which is a special type of directed tree.

Source: Al Doerr and Ken Levasseur, http://faculty.uml.edu/klevasseur/ads-latex/ads.pdf

This work is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 3.0 License.