[Math] Why is the Prüfer sequence in a labeled tree always unique

graph theory

The Prüfer sequence (also Prüfer code or Prüfer numbers) of a labeled tree is a unique sequence associated with the tree.

enter image description here

as we can see from the picture there is a unique sequence {4,4,4,5} #
but how can we prove that it is unique for a particular tree ?

Edit: Extracting from the wikipedia article on Prüfer sequences, the Prüfer sequence of a labeled tree is defined as follows:

One can generate a labeled tree's Prüfer sequence by iteratively
removing vertices from the tree until only two vertices remain.
Specifically, consider a labeled tree T with vertices {1, 2, …, n}.
At step i, remove the leaf with the smallest label and set the ith
element of the Prüfer sequence to be the label of this leaf's
neighbour.

Best Answer

The uniqueness of the prufer sequence comes from the fact that the trees are reconstructable.

For example, with $\{4,4,4,5\}$ The first number not in the code is $1$, so we attach vertex $1$ to $4$(the first entry in the code) now drop the $4$ from the code and add a $1$ to the back to get $\{4,4,5,1\}$.

The first number not in the code is $2$, so attach $2$ to $4$, drop the $4$ and add $2$ to the back to get $\{4,5,1,2\}$.

The first number not in the code is $3$, so attach $3$ to $4$, drop the $4$ and add $3$ to the back to get $\{5,1,2,3\}$

The first number not in the code is $4$, so attach $4$ to $5$, drop the $5$ and add $4$ to the back to get $\{1,2,3,4\}$.

Now we have exhausted the entire original code. The final step is to add an edge between the two numbers not shown in our new code, so attach $5$ to $6$.

This will give you back the original tree. Since we have a way to "Uncode" the prufer code, it is unique.