TITLE: Is there a simple inductive procedure for generating labeled trees uniformly at random, without direct recourse to Prüfer sequences?
QUESTION [12 upvotes]: Suppose you have a labeled tree $T$ on vertices $V=\lbrace 1,\ldots,n\rbrace$ that is drawn uniformly at random from the set of all $n^{n-2}$ such trees. I am seeking an $f$ satisfying the following desiderata:
D1.  $f(T)$ is a (random) tree on the vertex set $V'=\lbrace 1,\ldots,n+1\rbrace$;
D2. the distribution of $f(T)$ is uniform over the set of all $(n+1)^{n-1}$ labeled trees on $V'$;
D3. $f$ is a simple graph-theoretic recipe.
This $f$ can be a random function. That is, it can flip coins in deciding what to do with $T$: for instance, removing an edge uniformly at random.
One obvious way to satisfy D1 and D2 is: 

convert $T$ to its Prüfer sequence $s$;
independently, with probability $1/(n+1)$, change each entry of $s$ to $n+1$ (otherwise leave it fixed); 
then add a random number to the end of $s$, drawn uniformly from $V'$;
let $f(T)$ be the tree corresponding to the new sequence.

But what this procedure "really does" to $T$ seems not so easy to describe in graph-theoretic terms. I am looking for a recipe that satisfies D1-3 by manipulating the graph "directly" (i.e., adding and removing edges) without opaque steps like (1) and (4) in the above procedure.

REPLY [4 votes]: Yes, there is a simple method if you allow some non-determinism.  Given a labelled tree $T$ on $n$ vertices, uniformly randomly choose a vertex $v$ and a number $k\in[1,n+1]$. Attach a new vertex via an edge to $v$, add 1 to every label that is $k$ or more, and label the new vertex with $k$. This gives a tree $T'$ with $n+1$ vertices. However, the probability of each labelled tree on $n+1$ being generated is proportional to its number of leaves, since each leaf represents a way this tree could have been generated. We can correct this with a probabilistic filter: if $\ell$ is the number of leaves of $T'$, reject $T'$ and start over with probability $1-2/\ell$. Keep doing this until a tree is accepted. The expected number of trials before a tree is accepted is at most $n/2$.  Probably it is close to $n/(2e)$ since the average number of leaves is $n/e$.