alifestd_make_balanced_bifurcating

alifestd_make_balanced_bifurcating(depth: int) DataFrame

Build a perfectly balanced bifurcating tree of given depth.

Parameters

depthint

Depth of the tree, where depth=1 is a single root node.

  • depth=0 -> empty tree (no nodes)

  • depth=1 -> 1 node (root only)

  • depth=2 -> 3 nodes (root + 2 leaves)

  • depth=3 -> 7 nodes (4 leaves)

  • depth=4 -> 15 nodes (8 leaves)

Returns

pd.DataFrame

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

Raises

ValueError

If depth is negative.