master <- BalancedTree(12)
master <- Preorder(master) # Nodes must be listed in Preorder sequence
plot(master)
nodelabels()
allTips <- master[["tip.label"]]
keptTips <- sample(allTips, 8)
plot(KeepTip(master, keptTips))
kept <- KeptVerts(master, allTips %in% keptTips)
map <- which(kept)
# Node `i` in the reduced tree corresponds to node `map[i]` in the original.
Run the code above in your browser using DataLab