Density Based Clustering in JavaScript