alifestd_make_edge_split
- alifestd_make_edge_split(n_leaves: int, seed: int | None = None) DataFrame
Build a random bifurcating tree via edge-split (PDA) sampling.
At each step, a uniformly chosen existing edge is split by inserting a new internal node, with a new leaf attached as its sibling. This produces samples from the Proportional-to-Distinguishable-Arrangements (PDA) distribution over rooted bifurcating tree shapes.
Ids are contiguous but not topologically sorted; inserted internal nodes may have ids greater than some of their descendants. Pass the result through
alifestd_topological_sortif topological id order is needed.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.