for cluster_label, nodes_subset in groups:
if len(nodes_subset) > 1:
// identify all the (weakly connected) component in cluster
wccs = list(nx.weakly_connected_components(G.subgraph(nodes_subset.index)))
if len(wccs) > 1:
// if there are multiple components in this cluster
suffix = 0
for wcc in wccs:
// set subcluster xy to the centroid of just these nodes
subcluster_centroid = node_points.loc[wcc].unary_union.centroid
gdf.loc[wcc, "x"] = subcluster_centroid.x
gdf.loc[wcc, "y"] = subcluster_centroid.y
// move to subcluster by appending suffix to nodes cluster label
gdf.loc[wcc, "cluster"] = "{}-{}".format(cluster_label, suffix)