# generate a random tree
Ntips = 1000
parameters = list(birth_rate_intercept=1,death_rate_intercept=0.9)
tree = generate_random_tree(parameters,Ntips,coalescent=FALSE)$tree
# pick a random set of "target" tips
target_tips = sample.int(n=Ntips, size=5, replace=FALSE)
# find farthest target tip to each tip & node in the tree
results = find_farthest_tips(tree, target_tips=target_tips)
# plot histogram of distances to target tips (across all tips of the tree)
distances = results$farthest_distance_per_tip
hist(distances, breaks=10, xlab="farthest distance", ylab="number of tips", prob=FALSE);
Run the code above in your browser using DataLab