## 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