The DBSCAN algorithm in Scala