- random_unlabeled_rooted_forest(n, *, q=None, number_of_forests=None, seed=None)#
Returns a forest or list of forests selected at random.
Returns one or more (depending on
number_of_forests) unlabeled rooted forests with
nnodes, and with no more than
qnodes per tree, drawn uniformly at random. The “roots” graph attribute identifies the roots of the forest.
The number of nodes
- qint or None (default)
The maximum number of nodes per tree.
- number_of_forestsint or None (default)
If not None, this number of forests is generated and returned.
- seedinteger, random_state, or None (default)
Indicator of random number generation state. See Randomness.
nis non-zero but
This function implements the algorithm “Forest” of . The algorithm needs to compute some counting functions that are relatively expensive: in case several trees are needed, it is advisable to use the
number_of_forestsoptional argument to reuse the counting functions.