Package 

Class NonHierarchicalDistanceBasedAlgorithm

  • All Implemented Interfaces:
    com.google.maps.android.clustering.algo.Algorithm

    
    public class NonHierarchicalDistanceBasedAlgorithm<T extends ClusterItem>
    extends AbstractAlgorithm<T>
                        

    A simple clustering algorithm with O(nlog n) performance. Resulting clusters are not hierarchical.

    High level algorithm:

    • Iterate over items in the order they were added (candidate clusters).

    • Create a cluster with the center of the item.

    • Add all items that are within a certain distance to the cluster.

    • Move any items out of an existing cluster if they are closer to another cluster.

    • Remove those items from the list of candidate clusters.

    Clusters have the center of the first element (not the centroid of the items within it).