Sebastiao Pereira implements an algorithm:
Ordering points to identify the clustering structure (OPTICS) is an algorithm for finding density-based clusters very similar do DBSCAN. However, OPTICS handles it more effectively in the case of a cluster with varying densities gaining deeper insights exploring the hierarchical structure of your data. This algorithm is generally more computationally intensive.
Is it possible to have the OPTICS clustering algorithm implemented in SQL Server without using an external solution?
Click through for that implementation.