Python Optimal Leaf Ordering for Hierarchical Clustering Polo is a python script to obtain optimal linear ordering of hierarchical clusters, using the algorithm described in Fast Optimal leaf ordering for hierarchical clustering, Bioinformatics 2001 by Ziv Bar-Joseph, David K. Gifford, Tommi S. Jaakkola. When a hierarchical cluster with n leaves is displayed as a dendrogram, there are 2^(n-1) possible trees to display. The optimal linear ordering is the one where the distance between successive leaves is minimized (even when the leaves come from different clusters). Here is an example of the default ordering obtaining from fastcluster's linkage function, compared to the optimal linear order.