Class DefaultClusteringAlgorithm

java.lang.Object
ffx.numerics.clustering.DefaultClusteringAlgorithm
All Implemented Interfaces:
ClusteringAlgorithm

public class DefaultClusteringAlgorithm extends Object implements ClusteringAlgorithm
Clustering algorithm that operates on a full N x N distance matrix to produce hierarchical agglomerative clusters (dendrogram), with optional support for per-element weights and flat clustering by threshold.
Since:
1.0
Author:
Lars Behnke, 2013, Michael J. Schnieders
  • Constructor Details

    • DefaultClusteringAlgorithm

      public DefaultClusteringAlgorithm()
  • Method Details

    • performClustering

      public Cluster performClustering(double[][] distances, String[] clusterNames, LinkageStrategy linkageStrategy)
      Performs hierarchical agglomerative clustering using a full N x N distance matrix.
      Specified by:
      performClustering in interface ClusteringAlgorithm
      Parameters:
      distances - an N x N symmetric matrix of pairwise distances
      clusterNames - names corresponding to rows/columns of the distance matrix
      linkageStrategy - linkage criterion used to compute inter-cluster distances
      Returns:
      root Cluster of the resulting hierarchy
    • performFlatClustering

      public List<Cluster> performFlatClustering(double[][] distances, String[] clusterNames, LinkageStrategy linkageStrategy, Double threshold)
      Produces a flat clustering by agglomerating until the next merge would exceed the threshold.
      Specified by:
      performFlatClustering in interface ClusteringAlgorithm
      Parameters:
      distances - an N x N symmetric matrix of pairwise distances
      clusterNames - names corresponding to the distance matrix
      linkageStrategy - linkage criterion used during agglomeration
      threshold - maximum allowed linkage distance for merging
      Returns:
      list of clusters at the chosen cut
    • performWeightedClustering

      public Cluster performWeightedClustering(double[][] distances, String[] clusterNames, double[] weights, LinkageStrategy linkageStrategy)
      Performs hierarchical clustering when each element has an associated weight.
      Specified by:
      performWeightedClustering in interface ClusteringAlgorithm
      Parameters:
      distances - an N x N symmetric matrix of distances
      clusterNames - names for the N input elements
      weights - weights for the N input elements
      linkageStrategy - linkage criterion to use
      Returns:
      root Cluster of the resulting hierarchy