Learn R Programming

treebalance (version 1.2.0)

totCophI: Calculation of the total cophenetic index for rooted trees

Description

This function calculates the total cophenetic index \(TCI(T)\) of a given rooted tree \(T\). The tree must not necessarily be binary. \(TCI(T)\) is defined as $$TCI(T)=\sum_{1\leq i<j\leq n} \delta(lca(i,j))=\sum_{u\in V_{in}(T)\setminus\{\rho\}} binom(n_u,2)$$ in which \(\delta(lca(i,j))\) denotes the depth of the lowest common ancestor of the two leaves \(i\) and \(j\) and \(V_{in}(T)\setminus\{\rho\}\) denotes the set of all inner vertices exept the root and \(n_u\) denotes the number of descendant leaves of \(u\). The second formula is useful for efficient computation of \(TCI(T)\). The total cophenetic index is an imbalance index.

For \(n=1\) the function returns \(TCI(T)=0\).

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

Usage

totCophI(tree)

Value

totCophI returns the total cophenetic index of the given tree.

Arguments

tree

A rooted tree in phylo format.

Author

Sophie Kersting

References

A. Mir, F. Rossello, and L. Rotger. A new balance index for phylogenetic trees. Mathematical Bio-sciences, 241(1):125-136, 2013. doi: 10.1016/j.mbs.2012.10.005.

Examples

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

Run the code above in your browser using DataLab