Clustering data that are graph connected