Skip to contents

Create a random ranked phylogeny using the coalescent method.

Usage

random_tree(n)

Arguments

n

the number of tips

Value

random ranked tree of class "rankedPhylo"

Details

This is implementation of a ranked coalescent algorithm described in Collienne (2021). Starting from n tips of a tree, all with rank 0, randomly select two tips and merge them into a new node with rank 1, and add the new node to remaining tips. In next iteration, assign rank 2 and so on, until only a single node, the root, remains.

References

Collienne, L. (2021). Spaces of Phylogenetic Time Trees (p. 158). University of Otago.

Examples

random_tree(5)
#> 
#> Phylogenetic tree with 5 tips and 4 internal nodes.
#> 
#> Tip labels:
#>   t1, t2, t3, t4, t5
#> 
#> Rooted; includes branch lengths.