pypsa.clustering.ClusteringAccessor.cluster_spatially_by_greedy_modularity#
- ClusteringAccessor.cluster_spatially_by_greedy_modularity(n_clusters: int, buses_i: pd.Index | None = None, line_length_factor: float = 1.0) Clustering #
Create a busmap according to Clauset-Newman-Moore greedy modularity maximization [CNM2004_2].
- Parameters:
n (pypsa.Network)
n_clusters (int) – Final number of clusters desired.
buses_i (None | pandas.Index, default=None) – Subset of buses to cluster. If None, all buses are considered.
line_length_factor (float, default=1.0) – Factor to multiply the spherical distance between two new buses to get new line lengths.
- Returns:
Clustering – A named tuple containing network, busmap and linemap.
- Return type:
named tuple
References
[CNM2004_2]Clauset, A., Newman, M. E., & Moore, C. “Finding community structure in very large networks.” Physical Review E 70(6), 2004.