These are questions and answers about Hac, our open-source hierarchical agglomerative clustering library.
Dendrogram
is a binary tree. Dendrogram.getRoot()
gives you the DendrogramNode
that is the root of that tree. Nodes in that tree are either ObservationNode
s (leaf node; subclass of DendrogramNode
representing a singleton cluster corresponding to a single observation) or MergeNode
s (interior node; subclass of DendrogramNode
representing a cluster consisting of two sub-clusters). MergeNodes.getDissimilarity()
tells you the dissimilarity between a MergeNode
's two sub-clusters. That's what allows you to stop the traversal at a given dissimilarity. If you want to stop at a given cluster size, you won't even need that (just count the nodes in the subtree).