- Previewing commit 265592841051308032
Definition 1. Let denote the set of labeled trees on vertex set . Let denote the set of sequences where for all .
Theorem. There exists a bijection .
Construction of (Tree to Prüfer sequence):
Given , define by the following algorithm:
For :
- Let be the leaf with minimum label in the current tree
- Let be the unique neighbor of
- Remove from the tree
Construction of (Prüfer sequence to tree):
Given , construct as follows:
- Define degree sequence: for all
- For :
- Let be the minimum element with
- Add edge to
- Set and
- Add edge between the two remaining vertices with degree 1
Proof of Bijectivity:
Lemma 1. The forward construction is well-defined.
Proof: At each step, exactly one leaf exists with minimum label since we have a tree with vertices.
Lemma 2. The reverse construction produces a tree.
Proof: The degree sequence satisfies . At each step, exactly one vertex has degree 1 and is minimal. The final graph is connected with edges, hence is a tree.
Lemma 3. for all .
Proof: Let . In the forward construction, vertex (the -th leaf removed) has degree 1 in the initial tree. In the reverse construction with sequence , we have initially, and is chosen at step since it's the minimal vertex with degree 1. The edge added in reverse construction matches the edge removed in forward construction.
Lemma 4. for all .
Proof: Let where . By construction of , at step of computing , the minimum leaf is (the vertex chosen at step in reverse construction), and its neighbor is .
Corollary. establishes the bijection.
Since and , we have is bijective.