merge_small_clusters

merge_small_clusters(graph: TGraph, partition_tensor: LongTensor, min_size)[source]

Merge small clusters with adjacent clusters such that all clusters satisfy a minimum size constraint.

This function iteratively merges the smallest cluster with its neighbouring cluster with the maximum normalized cut.

Parameters:
  • graph – Input graph

  • partition_tensor – input partition vector mapping nodes to clusters

  • min_size – desired minimum size of clusters

Returns:

new partition tensor where small clusters are merged.