alifestd_make_leaf_split

alifestd_make_leaf_split(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

pd.DataFrame

Alife-standard phylogeny dataframe with ‘id’ and ‘ancestor_list’ columns.

Raises

ValueError

If n_leaves is negative.