I am looking for algorithms for the uniform sampling of labelled trees on $n$ vertices with the constraint that none of the vertices should have degree 2. Are there any results for this problem?
Such trees have a Prüfer sequence in which no entry appears precisely once.
For clarification, and example of such a tree is:
One approach is the following:
The result is going to give a uniformly random tree with the constraint, because in each $n$-vertex tree, there are $\binom{n+k}{n}$ ways to undo step 4, and $(n-1)n(n+1)(\dots)(n+k-2)$ ways to undo step 3 (for each vertex of degree 2, in order from smallest to largest, pick an edge to insert it on). So each $n$-vertex tree can be obtained in the same number of ways.
(I guess, equivalently, we could choose a random Prüfer code for an $(n+k)$-vertex tree, and delete the entries that only show up once, changing the labels of the rest in the same way as before. We'd have to be careful to distinguish labels that appeared $0$ times from labels that appeared $1$ time that we deleted, when we relabel.)
The tricky part is choosing $k$. Each label occurs exactly once in the Prüfer code with probability approximately $\frac 1e$, so the expected number of vertices of degree $2$ is approximately $\frac{n+k}{e}$. This makes it reasonable to choose $k = \lfloor \frac n{e-1}\rfloor$, for example.
The probability of getting exactly $k$ degree-$2$ vertices can be approximated by $\Pr[\text{Binomial}( n+k, \frac1e) = k]$, which is $O(\frac{1}{\sqrt n})$. This is not quite true, because the degrees are not independent, but still suggests that only $O(\sqrt n)$ trials are needed.
Here's a simple implementation using IGraph/M in Mathematica:
A faster, but somewhat less simple version: