I want to randomly generate trees, i.e. undirected acyclic graphs with a single root, making sure that all possible trees with a fixed number of nodes n are equally likely.
Knuth says to look at it as generating all nested parentheses in lexicographic order.
Look here for the details
|show 1 more comment|