Wraps stats::hclust to produce a normalized output that mirrors
the webtool's pure-JS clusterSetOrder and Python
cluster_set_order.
Usage
cluster_set_order(D, linkage = c("average", "complete", "single"))Value
A list with:
leaf_order: 1-based integer vector — left-to-right ordering of original indices. At each internal node the subtree whose minimum original leaf index is smaller is placed on the left (deterministic; mirrors the webtool / Python convention).merges: data.frame with columnsleft,right(0-based cluster ids matching the webtool/Python convention; leaves are 0..N-1, internal nodes are N..2N-2),height(linkage distance),size(number of leaves in the merged cluster).