Skip to content

PhylogeneticTrees ​

The rooted binary trees on nn labeled leaves with unlabeled internal nodes, as a lazy indexed family.

PhylogeneticTrees(n)every rooted binary tree with leaves labeled 1,…,n1, …, n and unlabeled internal nodes.
Typed signatures
TypePackageApplies
(integer<0..>) -> indexed_collection<phylogenetic_tree>combinatoricsalways

Domain: Collections

Details
  • A lazy indexed collection; the count is (2n−3)!!=A001147(n−2)(2n-3)!! = A001147(n-2) — PhylogeneticTrees(5)PhylogeneticTrees(5) has 105105 elements. See Factorial2.
  • Built by successive insertion: start from the cherry {1,2}\{1,2\}, then for k=3,…,nk = 3, …, n attach leaf kk at one of 2k−32k-3 places — above the current root, or subdividing one of the tree's edges.
  • Each element is the digit sequence (d3,…,dn)(d_3, …, d_n) with dk∈[0,2k−3)d_k \in [0, 2k-3) recording that insertion choice at each step; AtAt unranks it as a mixed-radix number in those insertion-step radices.

Enumeration

Examples

1 more kept as data, checked against the oracles
Basic #

Count(PhylogeneticTrees(5))=105=(2⋅5−3)!!Count(PhylogeneticTrees(5)) = 105 = (2 \cdot 5 - 3)!!, A001147

live ↗
InCount(PhylogeneticTrees(5))\mathrm{Count}(\mathrm{PhylogeneticTrees}(5))Out105105
About
Examples2

See also: Factorial2, Count, At