Summary
TreeLength() (and the underlying C++ scorer) currently requires a fully binary tree — TreeLength.phylo() errors with `tree` must be binary on a multifurcating input. It would be valuable to score polytomous trees directly.
Motivation
Users routinely have non-binary trees to score: constraint trees, strict/majority consensus trees, hand-built trees with deliberate soft polytomies, and collapsed MPTs (now the default output of MaximizeParsimony(collapse = TRUE)). Today they must resolve arbitrarily first, which is awkward and can mislead.
Standard parsimony software (PAUP*, TNT) scores polytomous trees as the minimum length over all resolutions of each polytomy. For unordered (Fitch) characters this is the generalised Fitch algorithm (majority-rule set at a k-child node, cost = k − plurality), still linear time.
Scope / phasing
- Phase 1 (clean, high value): Fitch (equal weights) and implied weights. Generalised Fitch + per-character step extraction; the search kernel is unaffected (it only ever builds binary trees), so this is purely a scoring-API extension with no hot-path exposure.
- Phase 2 (semantically thornier): ordered / Sankoff (xform) and Brazeau inapplicable (NA). "Length of a polytomy" splits into hard (star) vs soft (min-resolution); for step matrices the soft version is a real optimisation, not a free generalisation. Decide and document the interpretation rather than silently picking one.
Priority
Low — nice-to-have utility; revisit in due course.
Summary
TreeLength()(and the underlying C++ scorer) currently requires a fully binary tree —TreeLength.phylo()errors with`tree` must be binaryon a multifurcating input. It would be valuable to score polytomous trees directly.Motivation
Users routinely have non-binary trees to score: constraint trees, strict/majority consensus trees, hand-built trees with deliberate soft polytomies, and collapsed MPTs (now the default output of
MaximizeParsimony(collapse = TRUE)). Today they must resolve arbitrarily first, which is awkward and can mislead.Standard parsimony software (PAUP*, TNT) scores polytomous trees as the minimum length over all resolutions of each polytomy. For unordered (Fitch) characters this is the generalised Fitch algorithm (majority-rule set at a k-child node, cost = k − plurality), still linear time.
Scope / phasing
Priority
Low — nice-to-have utility; revisit in due course.