Reorders objects so that nearby object pairs are adjacent.
1 2 
x 
is the result of 
dis 
is a distance matrix or 
... 
additional arguments. 
In hierarchical cluster displays, a decision is needed at each merge to specify which subtree should go on the left and which on the right. This algorithm uses the order suggested by Gruvaeus and Wainer (1972). At a merge of clusters A and B, the new cluster is one of (A,B), (A',B), (A,B'),(A',B'), where A' denotes A in reverse order. The new cluster is chosen to minimize the distance between the object in A placed adjacent to an object from B.
A permutation of the objects represented by dis
is returned.
Catherine B. Hurley
Hurley, Catherine B. “Clustering Visualisations of Multidimensional Data”, Journal of Computational and Graphical Statistics, vol. 13, (4), pp 788806, 2004.
Gruvaeus, G. and Wainer, H. (1972), “Two Additions to Hierarchical Cluster Analysis”, British Journal of Mathematical and Statistical Psychology, 25, 200206.
hclust
,
order.hclust
.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34  data(eurodist)
dis < as.dist(eurodist)
hc < hclust(dis, "ave")
layout(matrix(1:2,nrow=2,ncol=1))
op < par(mar=c(1,1,1,1))
plot(hc)
hc1 < reorder.hclust(hc, dis)
plot(hc1)
par(op)
layout(matrix(1,1))
# Both dedrograms correspond to the same tree structure,
# but the second one shows that
# Paris is closer to Cherbourg than Munich, and
# Rome is closer to Gibralter than to Barcelona.
# We can also compare both orderings with an
# image plot of the colors.
# The second ordering seems to place nearby cities
# closer to each other.
layout(matrix(1:2,nrow=2,ncol=1))
op < par(mar=c(1,6,1,1))
cmat < dmat.color(eurodist, rev(cm.colors(5)))
plotcolors(cmat[hc$order,hc$order], rlabels=labels(eurodist)[hc$order])
plotcolors(cmat[hc1$order,hc1$order], rlabels=labels(eurodist)[hc1$order])
layout(matrix(1,1))
par(op)

Questions? Problems? Suggestions? Tweet to @rdrrHQ or email at ian@mutexlabs.com.
All documentation is copyright its authors; we didn't write any of that.