brainconn.modularity
.modularity_finetune_und_sign¶
-
modularity_finetune_und_sign
(W, qtype='sta', gamma=1, ci=None, 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 with positive and negative weights. - qtype (str) – modularity type. Can be ‘sta’ (default), ‘pos’, ‘smp’, ‘gja’, ‘neg’. See Rubinov and Sporns (2011) for a description.
- gamma (float) – resolution parameter. default value=1. Values 0 <= gamma < 1 detect larger modules while gamma > 1 detects smaller modules.
- ci (Nx1
numpy.ndarray
| None) – initial community affiliation vector - 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