DisjointSet-based flat clustering