# NOT RUN {
# generate a random tree
Ntips = 1000
tree = generate_random_tree(list(birth_rate_intercept=1),Ntips)$tree
# pick random nodes
focal_nodes = sample.int(n=tree$Nnode, size=3, replace=FALSE)
# get tips for mrcas
tips_per_focal_node = get_tips_for_mrcas(tree, focal_nodes);
# check correctness (i.e. calculate actual MRCAs of tips)
for(n in 1:length(focal_nodes)){
mrca = get_mrca_of_set(tree, tips_per_focal_node[[n]])
cat(sprintf("Focal node = %d, should match mrca of tips = %d\n",focal_nodes[n],mrca-Ntips))
}
# }
Run the code above in your browser using DataLab