Prüfer sequence for an order-2 tree?

381 Views Asked by At

All the algorithms for constructing a Prüfer sequence state that the input is a tree, but none give any output corresponding to an order-2 tree.

And Wikipedia gives this definition:" A Prüfer sequence of a labeled tree is a unique sequence associated with the tree." Then it adds, "The sequence for a tree on n vertices has length n − 2."

Okay, am I correct to understand then that the Prüfer sequence of a tree with exactly two vertices is the empty sequence, then the Prüfer sequence for a trivial tree is undefined?

1

There are 1 best solutions below

4
On BEST ANSWER

In order to use a Prüfer sequence to reconstitute a tree, you have to have the set of labeled vertices. If there are one or two vertices only, then the tree is apparent. So with so few vertices, the empty sequence does indeed uniquely reconstitute the tree.

In other words, "uniqueness" applies among all trees of the same size vertex set. Most of the time, uniqueness extends across different sized vertex sets just by virtue of different length Prüfer codes.