
Last chance! 50% off unlimited learning
Sale ends in
nodeImb(tree,node)
ladderDist(tree,node)
nodeDist(tree,node)
phylo4
nodeImb
(stands for node imbalance) returns the number of tip descendants below the node on the left side and the right as a vector of size 2. treeImb
calculates this for every node.
ladderDist
(ladder distance) gives the largest ladder size (away from the root) starting from the given node. It is based on rootLaddDist
. Note that ladder size is given by the number of edges it is made up of.
nodeDist
gives the number of steps from the root to the given node. In phylobase
, Depth is how far the node if from the root taking edge length into account. I have stuck with this convention so Dist is the number of steps required.treeImb
, rootLaddDist
and nodeDepth
## Creates a random tree of class phylo4 and plots it with nodes labelled by ID
tree <- rtree4(50)
tree <- idNodeLabel(tree)
plot(tree,show.tip.label=FALSE,show.node.label=TRUE)
## Calculate the imbalance of a node
nodeImb(tree,60)
## Calculates the length of the ladder from that node
ladderDist(tree,60)
## Finds the number of steps required to get from that node to the root
nodeDist(tree,60)
Run the code above in your browser using DataLab