maxDepth | R Documentation |

This function calculates the maximum 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)} \delta(v)`

with `\delta(v)`

being the depth of the vertex `v`

.
The maximum depth is an imbalance index.

For `n=1`

the function returns `h(T)=0`

and a warning.

For details on the maximum depth, see
also Chapter 23 in "Tree balance indices: a comprehensive survey" (https://doi.org/10.1007/978-3-031-39800-1_23).

```
maxDepth(tree)
```

`tree` |
A rooted tree in phylo format. |

`maxDepth`

returns the maximum depth, i.e. height, of a tree.

Luise Kuehn, Sophie Kersting

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.

```
tree <- ape::read.tree(text="((((,),),(,)),(((,),),(,)));")
maxDepth(tree)
tree <- ape::read.tree(text="((,),((((,),),),(,)));")
maxDepth(tree)
```

Embedding an R snippet on your website

Add the following code to your website.

For more information on customizing the embed code, read Embedding Snippets.