maxDepth: Calculation of the maximal depth of the tree

Description Usage Arguments Value Author(s) References Examples

View source: R/maxDepth.R

Description

This function calculates the maximal depth of any vertex in a rooted tree T, which is at the same time its height h(T). The tree must not necessarily be binary. Formally, h(T) is defined as

h(T)=max_{v in V(T)} depth(v)

with depth(v) being the depth of the vertex v. The maximal depth is an imbalance index.

For n=1 the function returns h(T)=0 and a warning.

Usage

1
maxDepth(tree)

Arguments

tree

A rooted tree in phylo format.

Value

maxDepth returns the maximal depth, i.e. height, of a tree.

Author(s)

Luise Kuehn, Sophie Kersting

References

C. Colijn and J. Gardy. Phylogenetic tree shapes resolve disease transmission patterns. Evolution, Medicine, and Public Health, 2014(1):96-108, 2014. ISSN 2050-6201. doi: 10.1093/emph/eou018.

Examples

1
2
3
4
tree <- ape::read.tree(text="((((,),),(,)),(((,),),(,)));")
maxDepth(tree)
tree <- ape::read.tree(text="((,),((((,),),),(,)));")
maxDepth(tree)

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