Some proofs about trees [00M0]
- September 14, 2026
The proofs in this section are also covered in a POGIL activity.
We pause here to prove a fundamental theorem about trees, partly as an example of the types of proofs we often do with graphs, and partly because trees show up all over the place and this theorem is of practical importance when designing algorithms.
Theorem Trees [00M1]
- September 14, 2026
Connected, acyclic graphs have n-1 edges [00M2]
- September 14, 2026
This is a proof of one part of the previous theorem, namely, that (1) and (2) together imply (3).
Proof.
- September 14, 2026
Let P(n) denote the statement “Any graph G with n vertices which is connected and acyclic must have n-1 edges.” We wish to show that P(n) holds for all n \geq 1.
The proof is by induction on n.
- The base case is when n = 1. In this case, G is just a single vertex, so it is indeed connected, acyclic, and has 0 edges.
For the induction step, suppose P(k) holds for some k \geq 1. That is, suppose that any graph with k vertices which is connected and acyclic must have k-1 edges. Then we wish to show P(k+1), that is, any graph with k+1 vertices which is connected and acyclic must have k edges.
So, let G be a graph with k+1 vertices which is connected and acyclic. We claim that G must have some vertex which is a leaf, that is, a vertex of degree 1, which we can show as follows:
- G cannot have any vertices of degree 0, because it is connected (and has at least two vertices).
- It also cannot be the case that every vertex of G has degree \geq 2. If they did, then we could find a cycle by starting at any vertex and walking along edges randomly until encountering a repeated vertex; we would never get stuck because every vertex has degree \geq 2, that is, if we come in along one edge there must always be a different edge along which we can leave. However, this is impossible because we assumed G is acyclic.
Hence, G must have some vertex which is a leaf. If we delete this vertex along with the edge adjacent to it, it results in a graph G' with only k vertices; we note that G' is still connected (because G was connected and we deleted a leaf) and also acyclic (because deleting something from an acyclic graph cannot create a cycle). Hence we may apply the induction hypothesis to conclude that G' has k-1 edges. Adding the deleted vertex and edge back to G' shows that G has k edges, which is what we wanted to show.
Acyclic graphs with n-1 edges are connected [00M3]
- September 14, 2026
This is a proof of another part of the previous theorem, namely, that (2) and (3) together imply (1). It uses a counting argument: we will show what we wish to show by counting things in multiple ways.
Proof.
- September 14, 2026
Let c denote the number of connected components of G. We want to show that c = 1.
Number the components of G from 1 \dots c, and say that component i has n_i vertices. Then \sum _{i=1}^c n_i = n, because adding up the number of vertices in each component gives the total number of vertices. Each connected component is by definition a connected graph; each component must also be acyclic since we assumed that G is acyclic. Hence we may apply Connected, acyclic graphs have n-1 edges to conclude that component i has n_i - 1 edges. Adding these up, the total number of edges in G is |E| = \sum _{i=1}^c (n_i - 1) = \left (\sum _{i=1}^c n_i \right ) - \left (\sum _{i=1}^c 1 \right ) = n - c. But we already assumed the number of edges in G is n-1, and hence c = 1 as desired.
[G5] Connected graphs with n-1 edges must be acyclic (2 pts) [00M4]
- September 14, 2026
Prove that for all n \geq 1, if G is a simple connected graph with n vertices and n-1 edges, then G has no cycles. (This is the third part of the proof from class, characterizing trees as having any two out of three properties.)
You may freely assume Connected, acyclic graphs have n-1 edges and Acyclic graphs with n-1 edges are connected if they are helpful; I also recommend studying their proofs as examples.
Hint.
- September 14, 2026
Use induction on n. By counting vertex degrees, show that any connected graph with k+1 vertices and k edges must have at least one leaf.
Hint.
- September 14, 2026
Use the [G4] Handshake lemma (1 pt).