get_clusters function

Compute the clusters