Lecture 1
Lecture 1
Lecture 1
Proof:
The first property can be seen by starting a path at an arbitrary node, walking to any
neighbor that hasn’t been visited before. After at most n steps, we must reach a vertex v
where there are no untraversed neighbors. v must therefore have only one neighbor and is
a leaf, otherwise there is a cycle and the graph is not a tree. We can then traverse a path
starting at v, and the vertex where the path stops must be a second leaf.
We can show the second property by induction. The base case n = 1 is trivial. Any tree of
size n > 1 has at least one leaf. Removing a leaf results in a tree with one less node and
one less edge. Therefore, a tree with n vertices has one more edge than a tree with n − 1
vertices. Applying this to the base case proves the result.
2 MS&E 212: Combinatorial Optimization - Lecture 1
n
How many graphs are there with n vertices? Since there are 2
distinct edges, there are
2( 2 ) graphs.
n
We call a graph labeled if the vertex ordering is important. How many labeled trees are
there for a given number of vertices n?
The idea of our proof will be to use a bijective mapping between labeled trees and something
easier to count. To prove Cayley’s theorem, we will use Prüfer codes.
To build the Prüfer code of a tree T (V, E), we use the following iterative procedure.
For t = 1, 2, · · · , n − 1,
• Let vertex i be the leaf with smallest label in T at step t, and vertex j its parent.
• Remove i from T .
We call the two n − 1 length strings A′ and B extended Prüfer code of T . Note that this is
just a permuted edge list of T .
By construction, the last entry of A′ must be n, since n will never be the leaf with smallest
label and there are always at least two leaves. The string A obtained by erasing the last
entry of A′ is the Prüfer code of T .
Proof:
Given A, we construct A′ by appending n to A. Let A′ = a1 a2 ...an−2 n, we construct B =
b1 b2 ...bn−1 as follows:
∀i, bi is the smallest number that hasn’t appeared in {b1 , .., bi−1 } ∪ {ai , ..., an−2 }. This can
be seen from the way in which Prüfer codes are constructed by ’pruning’ leaf from the
tree. At step i, we have removed nodes {b1 , .., bi−1 }, and it can’t be a parent (so it’s not in
MS&E 212: Combinatorial Optimization - Lecture 1 3
{ai , ..., an−2 }). All remaining nodes correspond to precisely the set of leaves, so bi must be
the smallest of these as stated.
• ∀v ∈ V , the degree of v is the number of times it appears in the code plus one.
Proof:
The first statement is obvious from the Prüfer code representation; there are n choices at
each n − 2 digit of the code. To see the second statement, simply note that the number of
times it appears in the code is the number of “child” vertices it has, then add one for being
a leaf at some point to account for the degree.
To prove the third statement, note that each tree produces a unique Prüfer code by the
deterministic nature of their construction. Also, as shown in lemma 1, we can uniquely
construct an edge list from each Prüfer code. All that remains to be shown is that the edge
list recovered must be a tree. This is easy to see, as at each stage in the reconstruction of
B from lemma 1, starting from the right we are adding nodes of degree one. Since we start
with a tree, and adding a node of degree one to a tree produces another tree, the final graph
must be a tree.
4
5