alifestd_make_edge_split_polars

alifestd_make_edge_split_polars(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_sort_polars if topological id order is needed.

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.