optimalleaforder
Compute the optimal leaf ordering of a hierarchical binary cluster tree.
The optimal leaf ordering of a tree is the ordering which minimizes the sum of the distances between each leaf and its adjacent leaves, without altering the structure of the tree, that is without redefining the clusters of the tree.
Required inputs:
linkage
function.
pdist
.
Optional inputs can be the following property/value pairs:
optimalleaforder’s output leafOrder is the optimal leaf ordering.
Reference Bar-Joseph, Z., Gifford, D.K., and Jaakkola, T.S. Fast optimal leaf ordering for hierarchical clustering. Bioinformatics vol. 17 suppl. 1, 2001.
See also: dendrogram, linkage, pdist
Source Code: optimalleaforder
randn ("seed", 5) # for reproducibility X = randn (10, 2); D = pdist (X); tree = linkage(D, 'average'); optimalleaforder (tree, D, 'Transformation', 'linear') ans = 10 8 3 5 9 7 2 4 6 1 |