Hierarchical clustering algorithms merge instances one after the other, in order of distance according to a chosen metric. The clustering stops, when a specified number of merged instances is left.
val clu = new HierarchicalClustering(k=3)
Below is the result of the clustering applied to the dataset of three distinct point clouds.