Enhanced Louvain community detection with shuffled node sequence and parallel computation
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.


Louvain Community Detection with shuffled node sequence


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

Version and Documentation

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

Parallel computation

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