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

