ForestPD (Python package forestpd) selects a set of taxa that maximizes phylogenetic
diversity (PD) summed over many phylogenetic trees, such as a Bayesian posterior sample,
bootstrap replicates or gene trees, under a budget on taxon costs and optionally with extinction
risks. It works on the trees directly, without a summary tree or network.
The algorithm is exact. Its running time is exponential only in the size of the agreement forests of the clusters that all trees share, so it handles thousands of trees on tens of thousands of taxa when the trees mostly agree. One run gives the optimum for every budget up to the one requested.
import forestpd as fpd
result = fpd.optimize_maxmpd(
["(A:1,B:1,(C:1,D:1):2);", "(A:1,C:1,(B:1,D:1):2);"], # or a file of Newick trees
budget=2,
return_taxa=True,
)
result.value # 8.0
result.taxa # {'A', 'D'} or {'B', 'C'}: both are optimal
Contents#
Installation covers forestpd and the optional maffe package. Background defines the problem and outlines the algorithm. The User guide describes how to use forestpd, and Examples has a complete analysis. The API reference documents every public function and class, and the Changelog lists the changes per version.
Indices#
Index: all functions and classes.
Module Index: all modules.
Search Page: search the documentation.
Citation#
If you use ForestPD in your research, please cite:
Niels Holtgrefe, Jannik Schestag, and Norbert Zeh. ForestPD: Maximizing Phylogenetic Diversity under Phylogenetic and Extinction Uncertainty. 2026.