# maxDelW: Calculation of the (modified) maximum difference in widths... In treebalance: Computation of Tree (Im)Balance Indices

 maxDelW R Documentation

## Calculation of the (modified) maximum difference in widths for a rooted tree

### Description

This function calculates the maximum difference in widths `delW(T)` and the modified maximum difference in width `mdelW(T)` for a given rooted tree `T`. The tree must not necessarily be binary. `delW(T)` is defined as

`delW(T)=\max_{i=0,...,h(T)-1} |w(i+1)-w(i)|`

and `mdelW(T)` is defined as

`mdelW(T)=\max_{i=0,...,h(T)-1} w(i+1)-w(i)`

in which `h(T)` denotes the height of the tree `T` and `w(i)` denotes the number of vertices in `T` that have depth `i`. The modified maximum difference in widths is a balance index, while the maximum difference in widths is neither a balance nor imbalance index.

Note that there was a spelling error in the previous manual of this function - we wrote "maximum difference in widths" while the given definition and the R code corresponded to the "modified maximum difference in width".

For details on the maximum difference in widths and the modified maximum difference in widths, see also Chapters 24 and 23 in "Tree balance indices: a comprehensive survey" (https://doi.org/10.1007/978-3-031-39800-1_24, https://doi.org/10.1007/978-3-031-39800-1_23).

### Usage

``````maxDelW(tree, method = "modified")
``````

### Arguments

 `tree` A rooted tree in phylo format. `method` A character string specifying whether the original maximum difference in widths or the modified maximum difference in widths shall be computed. Can be any of "original" or "modified" (default is modified).

### Value

`maxDelW` returns the maximum difference in widths of a tree (if `method` is set to `original`) or the modified maximum difference in widths (if `method` is set to `modified`).

### Author(s)

Sophie Kersting, Luise Kuehn

### References

C. Colijn, 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

``````tree <- ape::read.tree(text="((((,),),(,)),(((,),),(,)));")
maxDelW(tree, method="original")