brainconn.modularity
.modularity_finetune_und¶
-
modularity_finetune_und
(W, ci=None, gamma=1, seed=None)[source]¶ The optimal community structure is a subdivision of the network into nonoverlapping groups of nodes in a way that maximizes the number of within-group edges, and minimizes the number of between-group edges. The modularity is a statistic that quantifies the degree to which the network may be subdivided into such clearly delineated groups.
This algorithm is inspired by the Kernighan-Lin fine-tuning algorithm and is designed to refine a previously detected community structure.
Parameters: - W (NxN
numpy.ndarray
) – undirected weighted/binary connection matrix - ci (Nx1
numpy.ndarray
| None) – initial community affiliation vector - gamma (float) – resolution parameter. default value=1. Values 0 <= gamma < 1 detect larger modules while gamma > 1 detects smaller modules.
- seed (int | None) – random seed. default value=None. if None, seeds from /dev/urandom.
Returns: - ci (Nx1
numpy.ndarray
) – refined community affiliation vector - Q (float) – optimized modularity metric
Notes
Ci and Q may vary from run to run, due to heuristics in the algorithm. Consequently, it may be worth to compare multiple runs.
- W (NxN