Learn R Programming

apTreeshape (version 1.5-0.1)

spectrum.treeshape: Compute the spectrum of a tree

Description

This function returns a sequence containing the number of subtrees of size n, n-1, ..., 3, 2 where n is the size of the tree. The 'k'th element of the sequence is the number of subtrees of size n-k+1 in the tree, where n is the number of tips of the tree.

Usage

spectrum.treeshape(tree)

Arguments

tree

An object of class "treeshape".

Value

A sequence of size n-1 (where n is the number of tips of the tree) containing the number of subtrees of each size. spectrum.treeshape(tree)[1] is the number of subtrees with n tips (equal to 1). spectrum.treeshape(tree)[n-1] is the number of cherries of the tree (subtrees with 2 tips).

See Also

smaller.clade.spectrum

Examples

Run this code
# NOT RUN {
## A random Yule tree with 30 tips
tr<-rtreeshape(n=1,tip.number=30,model="yule")
tr<-tr[[1]]
spectre=spectrum.treeshape(tr)
spectre
  
## Number of cherries of the tree : nrow(tr$merge)==29
spectre[29]
# }

Run the code above in your browser using DataLab