phylogenetic tree cutting algorithm