brainconn.modularity
.modularity_probtune_und_sign¶
-
modularity_probtune_und_sign
(W, qtype='sta', gamma=1, ci=None, p=0.45, 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. High-modularity degeneracy is the presence of many topologically distinct high-modularity partitions of the network.
This algorithm is inspired by the Kernighan-Lin fine-tuning algorithm and is designed to probabilistically refine a previously detected community by incorporating random node moves into a finetuning algorithm.
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 - p (float) – probability of random node moves. Default value = 0.45
- 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