# totCophI: Calculation of the total cophenetic index for rooted trees In treebalance: Computation of Tree (Im)Balance Indices

## 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)=∑_{1<=i<j<=n} depth(lca(i,j)) =∑_{u in V'_in(T)} binom(n_u,2)

in which depth(lca(i,j)) denotes the depth of the last common ancestor of the two leaves i and j and V'_in(T) 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.

## Usage

 `1` ```totCophI(tree) ```

## Arguments

 `tree` A rooted tree in phylo format.

## Value

`totCophI` returns the total cophenetic index of the given tree.

Sophie Kersting

## References

A. Mir, F. Rosselló, 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

 ```1 2 3 4 5 6``` ```tree <- ape::read.tree(text="((((,),),(,)),(((,),),(,)));") totCophI(tree) tree <- ape::read.tree(text="((,),((((,),),),(,)));") totCophI(tree) tree <- ape::read.tree(text="((,,,),(,,));") totCophI(tree) ```

treebalance documentation built on Oct. 17, 2021, 5:06 p.m.