PhylogeneticTrees
The rooted binary trees on labeled leaves with unlabeled internal nodes, as a lazy indexed family.
PhylogeneticTrees(n)every rooted binary tree with leaves labeled and unlabeled internal nodes.Typed signatures
| Type | Package | Applies |
|---|---|---|
(integer<0..>) -> indexed_collection<phylogenetic_tree> | combinatorics | always |
Details
- A lazy indexed collection; the count is — has elements. See Factorial2.
- Built by successive insertion: start from the cherry , then for attach leaf at one of places — above the current root, or subdividing one of the tree's edges.
- Each element is the digit sequence with recording that insertion choice at each step; unranks it as a mixed-radix number in those insertion-step radices.
Definition
Epsil, as the implementation runs it.
count(_n)
Fold(Function(pc * (2pk - 3), pc, pk), 1, Range(3, _n, 1))unrank(_n, _r)
Map(
Function((_r - _r % Fold(
Function(pw * (2pi + 1), pw, pi),
1,
Range(pj + 1, Max(_n - 2, 0), 1),
)) / Fold(
Function(pw * (2pi + 1), pw, pi),
1,
Range(pj + 1, Max(_n - 2, 0), 1),
) % (2pj + 1), pj),
Range(1, Max(_n - 2, 0), 1),
)rank(_n, _x)
Fold(Function(pr * (2pd + 1) + _x[pd], pr, pd), 0, Range(1, Max(_n - 2, 0), 1))valid(_n, _x)
Fold(
Function(ok_pv && 0 <= _x[pv] && _x[pv] < 2pv + 1, ok_pv, pv),
True,
Range(1, Length(_x), 1),
) if Length(_x) == Max(_n - 2, 0) else FalseEnumeration
Examples
1 more kept as data, checked against the oraclesAbout
| Examples | 2 |
|---|
See also: Factorial2, Count, At