aryagraph.generators.random.random_tree#
- aryagraph.generators.random.random_tree(n: int, *, directed: bool = False, seed: int | Generator | None = None) Graph[source]#
Uniformly random labeled tree on
n >= 1nodes (decoded from a random Prüfer sequence).Every one of the
n^(n-2)labeled trees is equally likely. With directed, arcs point away from node0(an arborescence rooted at 0). Linear-time decoding.