Multilayer Modularity Belief Propagation (modbp)

A belief propagation solution to multilay modularity community detection.


We have implemented a belief propagation solution for multilayer modularity in both C++ and Python. Our implementation allows for both weighted and unweighted single layer networksas well as a variety of multilayer topologies. The C++ backend provides significant performance increaseand allows for running the algorithm at larger scale networks. Our method extends the approach of Pan Zhang and Christopher Moore [1] and provides a convenient interface with the standard networks analysis library, igraph.

Download and Installation:

The modbp module is hosted on PyPi. The easiest way to install is via the pip command:

pip install modbp

For installation from source, the latest version of modbp can be downloaded from GitHub:

For basic installation:

python install


To make our code run as quickly as possible, the underlying belief propagation algorithm has been written in C++. Wrapping and interfacing this code with the Python tools requires swig, a tool for creating Python classes from C++ objects.

The python dependencies for modbp are fairly standard tools for data analysis in Python:

  • NumPy : Python numerical analysis library.
  • sklearn :Machine learning tools for python.
  • python-igraph :igraph python version for manipulation of networks.
  • matplotlib :Python data visualization library.
  • pandas :data structures and data analysis tools for python.

These should all be handled automatically if using pip to install.

We are also working on creating a conda recipe for easy installation through conda forge.


[1]Pan Zhang and Cristopher Moore. Scalable detection of statistically significant communities and hierarchies, using message passing for modularity. Proceedings of the National Academy of Sciences, 111(51):18144–18149, 2014.


For more details and results see our manuscript