How many trees on vertices are there? Given vertices labeled to , how many ways can we add edges to make a tree?
- For , there’s only one tree.
- For , there’s still only one tree.
- For , we have multiple possible graphs, but we can only have one tree. If the vertices are labeled, then there are labeled trees.
- For , we can get:
orgraph 1((1)) o--o 2((2)); 1 o--o 3((3)); 1 o--o 4((4));
If the trees are labeled, we get total trees.graph LR; 1((1)) o--o 2((2)); 2 o--o 3((3)); 3 o--o 4((4));
- For , see trees with 5 vertices. If labeled, there are .
- For , we have .
In general, the formula is . This is known as Cayley’s Theorem.
Cayley’s Theorem
The number of labeled trees on vertices is .
Proof: We want to find a bijection from
Tree List: We repeatedly remove the smallest index leaf and then add its neighbor to a list until the tree only has vertices left.
List Tree: Let be the list we want to convert. Let be a list of numbers. Repeatedly, we find the smallest element of not in . Connect to the first element of , and remove in and . We do this until is empty. The remaining elements of get connected.
Try:
L = [7, 2, 8, 6, 3, 1, 7]
V = [1, 2, 3, 4, 5, 6, 7, 8, 9]
Note that L has two less elements. Recall the formula!
We want to claim that by induction on , that this is a bijection. In particular, the base case is boring. , and we only have one tree where is connected to . Now, assume . What if ?
Suppose we had tree with smallest leaf . We could partition a tree as
where is ‘s only neighboring vertex. Then our list would be . Since is the smallest leaf of not in our tree, then in our List Tree algorithm, then we have in the next iteration. This also produces . But then this is our inductive hypothesis, the exact we started with.
This tells us our algorithms are inverses in one direction.
Now, if is our smallest element of not in , then is the first element of , and where is our list. Thus, we need to show how
that our list decomposes to tree .
- I claim our smallest leaf is .
- I claim the proceeding Lemma (Counting Labeled Leaves), which we prove after this. Then following Tree List algorithm, with claim , then by the inductive hypothesis,
Essentially, we turn our tree back to our list that we started with. Indeed, by claim , we have .
Lemma (Counting Labeled Leaves)
Proof: Given a leaf,
graph LR; m((m)) o--o k((k));
We say can only be a leaf when at least one of its neighbors can be removed. This means will be added to the list. Therefore, it will be added times. But as leaves have degree , they will appear in the list times.
Generalized Cayley’s Theorem
The number of spanning trees of is equal to .
Matrix-Tree Theorem
The number spanning trees of is equal to where is defined as
and but remove the first row and column.