ST_IntersectsCC
Clustering
ST_IntersectsCC (Python)
Assign a connected component id to each geometry based on the ST_Intersects predicate.
Assign a connected component id to each geometry based on the ST_Intersects predicate.
Two geometries are in the same component if they are connected through any chain
of geometries that intersect each other.
SQL reference:

