Package elki.data

Class Clustering<M extends Model>

  • Type Parameters:
    M - Model type
    Direct Known Subclasses:
    ReferenceClustering

    public class Clustering<M extends Model>
    extends java.lang.Object
    Result class for clusterings. Can be used for both hierarchical and non-hierarchical clusterings. The class does not enforce or rely on clusterings to be a tree or DAG, instead they can be an arbitrary forest of directed graphs that COULD contain cycles. This class is NOT iterable for a simple reason: there is more than one method to do so. You need to specify whether you want to use getToplevelClusters() or getAllClusters().
    Since:
    0.2
    Author:
    Erich Schubert
    • Constructor Detail

      • Clustering

        public Clustering​(java.util.List<Cluster<M>> toplevelclusters)
        Constructor with a list of top level clusters
        Parameters:
        toplevelclusters - Top level clusters
      • Clustering

        public Clustering()
        Constructor for an empty clustering
    • Method Detail

      • addToplevelCluster

        public void addToplevelCluster​(Cluster<M> clus)
        Add a cluster to the clustering.
        Parameters:
        clus - new cluster
      • addChildCluster

        public void addChildCluster​(Cluster<M> parent,
                                    Cluster<M> child)
        Add a cluster to the clustering.
        Parameters:
        parent - Parent cluster
        child - Child cluster.
      • getToplevelClusters

        public java.util.List<Cluster<M>> getToplevelClusters()
        Return top level clusters
        Returns:
        top level clusters
      • getClusterHierarchy

        public Hierarchy<Cluster<M>> getClusterHierarchy()
        Get the cluster hierarchy.
        Returns:
        Cluster hierarchy.
      • getAllClusters

        public java.util.List<Cluster<M>> getAllClusters()
        Collect all clusters (recursively) into a List.
        Returns:
        List of all clusters.
      • iterToplevelClusters

        public It<Cluster<M>> iterToplevelClusters()
        Iterate over the top level clusters.
        Returns:
        Iterator
      • getClusteringResults

        public static java.util.List<Clustering<? extends Model>> getClusteringResults​(java.lang.Object r)
        Collect all clustering results from a Result
        Parameters:
        r - Result
        Returns:
        List of clustering results