The Louvain community detection is performed for the same graph with shuffled
node sequence and the community structure with the highest modularity score is
returned. The igraph.community_multilevel
algorithm is used for the community
detection.
Fabio Saracco, Mika J. Straka
The newest version and the documentation can be found on https://github.com/tsakim/Shuffled_Louvain.
The module has been written in Python 2.7 and uses the following packages:
Given an igraph.Graph object G
, we want to run n
community detections
in order to find the vertex clustering which returns the maximum modularity.
Each iteration is run on a different permutations of the node sequence of the
graph.
To import the module, use::
>>> from src import suffled_louvain as shulou
and run n
-times the community detection:
>>> vc = shulou.shuffled_comdet(G, n)
The membership list of the detected communities can be accessed with::
>>> vc.membership
Since the community detection can be computationally demanding, the module uses
the Python
multiprocessing
package to execute the computation in parallel. The number of parallel
processes depends on the number of CPUs of the work station ( see variable
numprocs
in method shuffled_comdet
).
If the calculation should not be performed in parallel, use::
>>> shulou.shuffled_comdet(G, n, parallel=False)
Copyright (c) 2016-2017 Fabio Saracco, Mika J. Straka