Trees
The following definitions are equivalent:
- is a tree (connected without cycle).
- For every two vertices , there exists exactly one path from to .
- The graph is connected and deleting any edge disconnects the graph.
- Graph has no cycle and adding any edge into creates a cycle.
- is connected and .
In these lecture notes, we will show the equivalence between (1) and (5). The other equivalences are left as an exercise. A leaf of a tree is a vertex of degree one. The following two lemmas will give us a natural way to do induction on a tree.
If is connected without cycle and , then contains at least two different leaves.
This is again one of those intuitively true statements. No matter how you try to draw it, it is true. But this is not a proof, since there are infinitely many trees, whereas proofs are finite.
Take to be a path of maximum length in . Note that . We claim that and are both leaves (do you see why they are different?). Assume otherwise that (the other case is similar). Then there is an edge where . If appears on , i.e., for , would be a cycle, which is a contradiction. Otherwise, if is not on , then the path is a path longer than , a contradiction since is a longest path.
Let be a leaf of . The following statements are equivalent: (i) is a tree and (ii) is a tree.
To prove (i) (ii), assume that is a tree, and we argue that is connected (the fact that does not have a cycle is even simpler!). Look at and take two vertices in (and thus none of those is ). Since is connected, there exists a path connecting and in . This path cannot contain since the degree of is one. Therefore, this is a path in . Since every and are connected via a path, the graph is connected.
To prove (ii) (i), assume that is a tree. Graph cannot have a cycle that involves (since has degree one), so we only need to check that is connected. Every pair of vertices in is connected in . Moreover, is connected to every in since we can first connect to via an edge and from to due to the connectedness of .
Notice that these lemmas are quite simple to prove, but they require some effort (especially the mental effort to resist the "proof by picture" temptation). Whenever we claim that a cycle exists, the proof explicitly shows a sequence of vertices that form a cycle. Whenever we claim connectedness, we explicitly identify a sequence of vertices on paths that connect pairs of vertices. Now we are ready to show the proof of the theorem.
We prove this by induction on the number of vertices. The induction hypothesis (IH): For all , is a tree if and only if is connected and . The base case when is trivial. Now assume that the IH is true for and consider a graph with vertices. To prove (1) (5), we need to argue that . From the previous two lemmas, there exists a leaf vertex in so that is a tree. We know, from IH, that and this implies that .
To prove the converse, assume that . First we argue that there exists a leaf in (do you see why we cannot just use the leaf lemma we already proved?). By connectedness, every vertex in has degree at least one. By the Handshake's lemma, we have . So there must be at least two vertices of degree one. Take to be a leaf of . Notice that is connected and satisfies , so by IH, we know that contains no cycle. Since has degree one, a cycle in cannot contain , so cannot have any cycle.
Notice that a nice property about trees is the inductive property we use above ( is a tree if and only if is a tree, when is a leaf). Trees are a very important objects in computer science and have played fundamental roles in almost every area of algorithm design.
Complete the proof of Theorem 6.
Draw all trees on the vertex set and all pairwise non-isomorphic trees.
Let be a tree with . Prove:
where denotes the number of vertices in having degree .
Notice that the above exercise provides an alternative proof of the Leaf lemma.