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 Cn 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 K2 is a tree. However, if n ≥ 3, a Kn 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 Let G = (V, E) be an undirected graph with no self-loops, and let va, vb V . If two different simple paths exist between va and vb , then there exists a cycle in G.

Proof. Let p1 = (e1, e2, . . . , em) and p2 = (f1, f2, . . . , fn) be two different simple paths from va to vb . The first step we will take is to delete from p1 and p2 the initial edges that are identical. That is, if e1 = f1, e2 = f2, . . ., e= fj, and e+ 1 ≠ f+ 1 delete the first j edges of both paths. Once this is done, both paths start at the same vertex, call it vc, and both still end at vb. Now we construct a cycle by starting at vc and following what is left of p1 until we first meet what is left of p2. If this first meeting occurs at vertex vd, then the remainder of the cycle is completed by following the portion of the reverse of p2 that starts at vd and ends at vc.


Theorem 10.1.11 Equivalent Conditions for a Graph to be a Tree. Let 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, v1 and v2. By (2), there is no simple path connecting v 1 to v2 other than e. Therefore, no path at all can exist between  v1 and vin (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,
Creative Commons License This work is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 3.0 License.

Last modified: Wednesday, August 18, 2021, 4:03 PM