: leafOrder = optimalleaforder (tree, D)
Function File: leafOrder = optimalleaforder (..., Name, Value)

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:

  • tree: a hierarchical cluster tree tree generated by the linkage function.
  • D: a matrix of distances as computed by pdist.

Optional inputs can be the following property/value pairs:

  • property ’Criteria’ at the moment can only have the value ’adjacent’, for minimizing the distances between leaves.
  • property ’Transformation’ can have one of the values ’linear’, ’inverse’ or a handle to a custom function which computes S the similarity matrix.

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.

Demonstration 1

The following code

 X = randn (10, 2);
 D = pdist (X);
 tree = linkage(D, 'average');
 optimalleaforder (tree, D, 'Transformation', 'linear')

Produces the following output

ans =

    4    9   10    1    7    8    6    2    5    3

Package: statistics