A tree on four labeled vertices can be a path or a star, with many labelings of each. Cayley’s formula counts all labeled trees at once: n^(n−2) for n≥2. The proof uses a reversible code of length n−2 with entries from the n labels. Establishing that every such word decodes to exactly one tree is essential; merely producing a word from each tree would only give one side of a counting argument.
Predict
Predict why a leaf is the right object to remove. Deleting a leaf preserves connectedness and absence of cycles on the remaining vertices. To make the code deterministic, always delete the smallest labeled leaf and record its unique neighbor. Continue until two vertices remain. The labels of deleted leaves need not be recorded because the decoder can recover them from the remaining word.
Experiment
Encode the tree with edges 12, 23, 24, 45.
Smallest leaf removed
Recorded neighbor
Remaining code prefix
1
2
2
3
2
2, 2
2
4
2, 2, 4
The last edge is 45. Decode the word (2, 2, 4) independently. At the first step, label one is the smallest label absent from the word; after removing its first entry, label three becomes the smallest available absent label.
Understand
For decoding, maintain the unused vertex labels and the remaining word. Choose the smallest unused label not appearing in that word, join it to the first word entry, remove the chosen label and that entry, and repeat. Such a label exists because the word is two shorter than the current label set. Finally join the two remaining labels. Each added edge attaches a vertex that is then removed from future consideration, so the resulting graph is connected and acyclic. In an encoded tree, a label appears once for each incident edge removed before its own final removal; hence it occurs degree minus one times. The labels absent from the remaining code are exactly the current leaves, making encoding and decoding inverse.
Apply
There are n choices for each of n−2 code positions, proving Cayley’s formula. The occurrence identity also gives a refinement: for positive degrees d_i summing to 2n−2, the number of labeled trees with those degrees is (n−2)! divided by product (d_i−1)!. The formula counts words with prescribed multiplicities. For n=4, a fixed star center has code consisting of that label twice, giving one tree for that center; the four choices of center account for four of the sixteen trees. Other words produce paths.
Continue
The labels matter: sixteen labeled trees on four vertices do not mean sixteen unlabeled shapes. Forgetting labels creates unequal orbit sizes because different trees have different automorphism groups, so division by n! is invalid. For n=2 the code is empty and describes the unique edge; n=1 is handled separately. Use the code as an implementation exercise with invariant checks for degrees and edge count, then verify decoding by an independent connectivity and cycle test rather than only re-encoding the same output.
Drafts save locally as you type. Reveal worked solutions when useful; the site remembers that exposure. Automatic matches check the requested answer, while written arguments require review against the rubric.
How many labeled trees are there on five vertices?
Integers, fractions and finite decimals are accepted. Expressions such as sqrt(2) are not parsed by this checker.
On five labels, how many trees have degrees (3, 2, 1, 1, 1)?
Integers, fractions and finite decimals are accepted. Expressions such as sqrt(2) are not parsed by this checker.
Describe Prüfer encoding and its inverse.
Structure your argument and preserve revisions
These optional planning fields save locally. Recording your response saves an immutable copy of the argument and these fields. Older records may contain only first/latest responses; missing intermediate revisions are not reconstructed.
Each field allows 2,000 characters. Keep a specific claim, state where it applies, cite the facts you use, and explain what still needs checking. Blank fields are allowed and are not evidence of mastery.
Prove label v occurs degree (v)−1 times in the code.
Structure your argument and preserve revisions
These optional planning fields save locally. Recording your response saves an immutable copy of the argument and these fields. Older records may contain only first/latest responses; missing intermediate revisions are not reconstructed.
Each field allows 2,000 characters. Keep a specific claim, state where it applies, cite the facts you use, and explain what still needs checking. Blank fields are allowed and are not evidence of mastery.
Derive the prescribed-degree count (n−2)!/product (d_i−1)!.
Structure your argument and preserve revisions
These optional planning fields save locally. Recording your response saves an immutable copy of the argument and these fields. Older records may contain only first/latest responses; missing intermediate revisions are not reconstructed.
Each field allows 2,000 characters. Keep a specific claim, state where it applies, cite the facts you use, and explain what still needs checking. Blank fields are allowed and are not evidence of mastery.
Explain the n=1 and n=2 cases separately.
Structure your argument and preserve revisions
These optional planning fields save locally. Recording your response saves an immutable copy of the argument and these fields. Older records may contain only first/latest responses; missing intermediate revisions are not reconstructed.
Each field allows 2,000 characters. Keep a specific claim, state where it applies, cite the facts you use, and explain what still needs checking. Blank fields are allowed and are not evidence of mastery.
Reflect and continue
Before marking this lesson complete, explain one key idea without the worked solution and identify a condition that matters. Marking complete records participation, not independent mastery.