alifestd_make_leaf_split_polars

alifestd_make_leaf_split_polars(n_leaves: int, seed: int | None = None) DataFrame

Build a random bifurcating tree via leaf-split (Yule) sampling.

At each step, a uniformly chosen leaf is replaced by an internal node with two new leaf children. This produces samples from the Yule (pure- birth) distribution over rooted bifurcating tree shapes.

Parameters

n_leavesint

Number of leaf nodes in the resulting tree.

seedint, optional

Integer seed for deterministic behavior.

Returns

pl.DataFrame

Phylogeny dataframe with ‘id’ and ‘ancestor_id’ columns.