Learn R Programming

treebalance (version 1.2.0)

cherryI: Calculation of the cherry index for rooted trees

Description

This function calculates the cherry index \(ChI(T)\) for a given rooted tree \(T\). The tree must not necessarily be binary. \(ChI(T)\) is defined as the number of cherries in the tree. A cherry is a pair of leaves that have the same direct ancestor. Note, if a vertex \(u\) has \(x\) leaves as direct descendants, the number of cherries induced by \(u\) is \(binom(x,2)\).

The cherry index does not fulfill the definition of an (im)balance index given in "Tree balance indices: a comprehensive survey" (Fischer et al., 2023).

For details on the cherry index, see also Chapter 24 in "Tree balance indices: a comprehensive survey" (https://doi.org/10.1007/978-3-031-39800-1_24).

Usage

cherryI(tree)

Value

cherryI returns the cherry index of the given tree.

Arguments

tree

A rooted tree in phylo format.

Author

Sophie Kersting

References

A. McKenzie and M. Steel. Distributions of cherries for two models of trees. Mathematical Biosciences, 164(1):81-92, 2000. doi: 10.1016/s0025-5564(99)00060-7.

Examples

Run this code
tree <- ape::read.tree(text="((((,),),(,)),(((,),),(,)));")
cherryI(tree)
tree <- ape::read.tree(text="((,),((((,),),),(,)));")
cherryI(tree)
tree <- ape::read.tree(text="((,,,),(,,));")
cherryI(tree)

Run the code above in your browser using DataLab