ST_ContainsCC
Clustering
ST_ContainsCC (Python)
Assign a connected component id to each geometry based on the ST_Contains predicate.
Assign a connected component id to each geometry based on the ST_Contains predicate.
Two geometries are in the same component if they are connected through any chain
of geometries where one contains another.
SQL reference:

