subtree.length {phybase}R Documentation

Calculate total branch length of a tree

Description

calculate the total branch length of a sub-tree under inode.

Usage

subtree.length(inode, nodes, nspecies)

Arguments

inode the root node of the sub-tree
nodes the tree node matrix
nspecies the number of species in the tree

Details

The node matrix is the output of the function read.unrooted.nodes or read.rooted.nodes. The function can calculate the total branch length of a tree if inode is set to be the root node. If inode is not the root node, subtree.length calculates the total branch length of a sub-tree.

Value

The function returns the total branch length of a sub-tree.

Author(s)

Liang Liu lliu@oeb.harvard.edu

See Also

node.height

Examples

tree.string<-"(((H:4.2,C:4.2):3.1,G:7.3):6.3,O:13.5);"
nodes<-read.tree.nodes(tree.string)$nodes
subtree.length(6,nodes,4)


[Package phybase version 1.1 Index]