exeCluster1D: Efficient Clustering Using Union-Find to Obtain the Clusters for Each Sample
Description
This function is the first step for Adaptive Kruskal algorithm for generating aggregate centers for Thiessen polygons with the aim to obtain the cluster id for each sample point.
Usage
exeCluster1D(samples, tdist)
Arguments
samples
Vector for samples with single vals
tdist
The target distance for generation of the clusters. If the minimun distance between any two samples respectively from two different clusters is bigger than tdist, clustering stops and return the results.
Value
vector format: cluster id for each sample (same sequence as the input)
Details
The Kruskal algorithm is used to obtain the sparse central points from dense points for efficient generation of Thiessen polygons for spatial effect modeling. This function aims to obtain the cluster id for each sample point. We used the union-find method for linear time complexity.
References
Thomas, C.; Leiserson, C.; Rivest, R.; Stein, C., Introduction To Algorithms (Third ed.). MIT Press: 2009