Skip to main content
louvain-igraph
==============

This package implements the louvain algorithm in ``C++`` and exposes it to
``python``. It relies on ``(python-)igraph`` for it to function. Besides the
relative flexibility of the implementation, it also scales well, and can be run
on graphs of millions of nodes (as long as they can fit in memory). The core
function is ``find_partition`` which finds the optimal partition using the
louvain algorithm [1]_ for a number of different methods. The methods currently
implemented are (1) modularity [2]_, (2) Reichardt and Bornholdt's model using
the configuration null model and the Erdös-Rényi null model [3]_, (3) the
constant Potts model (CPM) [4]_, (4) Significance [5]_, and finally (5)
Surprise [6]_. In addition, it supports multiplex partition optimisation
allowing community detection on for example negative links [7]_ or multiple
time slices [8]_. It also provides some support for community detection on
bipartite graphs. See the documentation for more information.

.. image:: https://readthedocs.org/projects/louvain/badge/?version=develop
:target: http://louvain.readthedocs.io/en/latest/?badge=develop
:alt: Louvain documentation status (development version)

.. image:: https://travis-ci.org/vtraag/louvain-igraph.svg?branch=develop
:target: https://travis-ci.org/vtraag/louvain-igraph
:alt: Louvain build status (development version)

.. image:: https://zenodo.org/badge/31305324.svg
:target: https://zenodo.org/badge/latestdoi/31305324
:alt: DOI
Installation
------------

In short, for Unix: ``sudo pip install louvain``. For Windows: download the
binary installers.

For Unix like systems it is possible to install from source. For Windows this
is overly complicated, and you are recommended to use the binary installation
files. There are two things that are needed by this package: the igraph ``C``
core library and the python-igraph python package. For both, please see
http://igraph.org.

Make sure you have all necessary tools for compilation. In Ubuntu this can be
installed using ``sudo apt-get install build-essential``, please refer to the
documentation for your specific system. Make sure that not only ``gcc`` is
installed, but also ``g++``, as the louvain package is programmed in ``C++``.
Note that to compile ``igraph`` itself, you also need to install
``libxml2-dev``.

You can check if all went well by running a variety of tests using ``python
setup.py test``.

There are basically two installation modes, similar to the python-igraph
package itself (from which most of the setup.py comes).

1. No ``C`` core library is installed yet. The packages will be compiled and
linked statically to an automatically downloaded version of the ``C`` core
library of igraph.
2. A ``C`` core library is already installed. In this case, the package will
link dynamically to the already installed version. This is probably also the
version that is used by the igraph package, but you may want to double check
this.

In case the python-igraph package is already installed before, make sure that
both use the **same versions**.

The cleanest setup it to install and compile the ``C`` core library yourself
(make sure that the header files are also included, e.g. install also the
development package from igraph). Then both the python-igraph package, as well
as this package are compiled and (dynamically) linked to the same ``C`` core
library.

Troubleshooting
---------------

In case of any problems, best to start over with a clean environment. Make sure
you remove the python-igraph package completely, remove the ``C`` core library
and remove the louvain package. Then, do a complete reinstall starting from
``pip install louvain``. In case you want a dynamic library be sure to then
install the ``C`` core library from source before. Make sure you **install the
same versions**.

Usage
-----

There is no standalone version of louvain-igraph, and you will always need
python to access it. There are no plans for developing a standalone version or
R support. So, use python. Please refer to the documentation for more details
on function calls and parameters.

Just to get you started, below the essential parts.
To start, make sure to import the packages:

>>> import louvain
>>> import igraph as ig

We'll create a random graph for testing purposes:

>>> G = ig.Graph.Erdos_Renyi(100, 0.1);

For simply finding a partition use:

>>> part = louvain.find_partition(G, louvain.ModularityVertexPartition);

Contribute
----------

Source code: https://github.com/vtraag/louvain-igraph

Issue tracking: https://github.com/vtraag/louvain-igraph/issues

See the documentation on `Implementation` for more details on how to
contribute new methods.

References
----------

Please cite the references appropriately in case they are used.

.. [1] Blondel, V. D., Guillaume, J.-L., Lambiotte, R., & Lefebvre, E. (2008).
Fast unfolding of communities in large networks. Journal of Statistical
Mechanics: Theory and Experiment, 10008(10), 6.
`10.1088/1742-5468/2008/10/P10008 <http://doi.org/10.1088/1742-5468/2008/10/P10008>`_

.. [2] Newman, M. E. J., & Girvan, M. (2004). Finding and evaluating community
structure in networks. Physical Review E, 69(2), 026113.
`10.1103/PhysRevE.69.026113 <http://doi.org/10.1103/PhysRevE.69.026113>`_

.. [3] Reichardt, J., & Bornholdt, S. (2006). Statistical mechanics of
community detection. Physical Review E, 74(1), 016110.
`10.1103/PhysRevE.74.016110 <http://doi.org/10.1103/PhysRevE.74.016110>`_

.. [4] Traag, V. A., Van Dooren, P., & Nesterov, Y. (2011). Narrow scope for
resolution-limit-free community detection. Physical Review E, 84(1),
016114. `10.1103/PhysRevE.84.016114
<http://doi.org/10.1103/PhysRevE.84.016114>`_

.. [5] Traag, V. A., Krings, G., & Van Dooren, P. (2013). Significant scales in
community structure. Scientific Reports, 3, 2930. `10.1038/srep02930
<http://doi.org/10.1038/srep02930>`_

.. [6] Traag, V. A., Aldecoa, R., & Delvenne, J.-C. (2015). Detecting
communities using asymptotical surprise. Physical Review E, 92(2),
022816. `10.1103/PhysRevE.92.022816
<http://doi.org/10.1103/PhysRevE.92.022816>`_

.. [7] Traag, V. A., & Bruggeman, J. (2009). Community detection in networks
with positive and negative links. Physical Review E, 80(3), 036115.
`10.1103/PhysRevE.80.036115
<http://doi.org/10.1103/PhysRevE.80.036115>`_

.. [8] Mucha, P. J., Richardson, T., Macon, K., Porter, M. A., & Onnela, J.-P.
(2010). Community structure in time-dependent, multiscale, and multiplex
networks. Science, 328(5980), 876–8. `10.1126/science.1184819
<http://doi.org/10.1126/science.1184819>`_

Licence
-------

Copyright (C) 2016 V.A. Traag

This program is free software: you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free Software
Foundation, either version 3 of the License, or (at your option) any later
version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY
WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with
this program. If not, see http://www.gnu.org/licenses/.

Metadata

Release files for louvain 0.6.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for louvain 0.6.0
File Size Uploaded Provenance Actions
louvain-0.6.0.tar.gz 90.6 kB Without provenance Details for louvain-0.6.0.tar.gz

Built distributions (wheels)

Table of built distributions (wheels) for louvain 0.6.0
File Actions
louvain-0.6.0-py3.6-linux-x86_64.egg Legacy Egg format - - Details for louvain-0.6.0-py3.6-linux-x86_64.egg
louvain-0.6.0-py2.7-linux-x86_64.egg Legacy Egg format - - Details for louvain-0.6.0-py2.7-linux-x86_64.egg
louvain-0.6.0-cp36-cp36m-win_amd64.whl CPython 3.6 CPython 3.6 pymalloc Windows x86-64 Details for louvain-0.6.0-cp36-cp36m-win_amd64.whl
louvain-0.6.0-cp27-cp27m-win_amd64.whl CPython 2.7 CPython 2.7 pymalloc Windows x86-64 Details for louvain-0.6.0-cp27-cp27m-win_amd64.whl

Total release size: 2.5 MB

Release files / louvain-0.6.0.tar.gz

Download URL louvain-0.6.0.tar.gz
Size 90.6 kB
Tags Source
SHA-256 checksum
How to use checksums
0dd113b55a12c4edfcac857c3da3a02dd05d4e23e2fbfef61d0ccd46382778b5
BLAKE2b-256 checksum
How to use checksums
2fe32517ddd2701403ee755cc6f7953afe79d4874bddc062e09dfb8adf6f3c98
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release files / louvain-0.6.0-py3.6-linux-x86_64.egg

Download URL louvain-0.6.0-py3.6-linux-x86_64.egg
Size 957.3 kB
Tags Egg
SHA-256 checksum
How to use checksums
ec3d4d53c657dd65a87bfdde296bfd8dfe453c2e31a1b7094b13f554f37cac65
BLAKE2b-256 checksum
How to use checksums
3d7b0ffcd01ceee63a6db81971de4e377a73e80e386a42ee0d8d8f48f26d45e0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release files / louvain-0.6.0-py2.7-linux-x86_64.egg

Download URL louvain-0.6.0-py2.7-linux-x86_64.egg
Size 950.2 kB
Tags Egg
SHA-256 checksum
How to use checksums
c9f512edc3f769d0222e1b9bccf5584d3cc30c84f435d3b48936550e03c47fd9
BLAKE2b-256 checksum
How to use checksums
2b1c0623ae0069ae09ea0f0479266c4b468b40fb75a5aecbc2ff086c09e6416f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release files / louvain-0.6.0-cp36-cp36m-win_amd64.whl

Download URL louvain-0.6.0-cp36-cp36m-win_amd64.whl
Size 95.1 kB
Tags CPython 3.6 CPython 3.6 pymalloc Windows x86-64
SHA-256 checksum
How to use checksums
b1cfb648af32f2c83908d66627aadda0b7084a6081ac5e2d832c3bd060b10c43
BLAKE2b-256 checksum
How to use checksums
02bd2b5977dede6920f9ba1f42f68a0064170b83fd096cfa3deb5bf19855e841
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release files / louvain-0.6.0-cp27-cp27m-win_amd64.whl

Download URL louvain-0.6.0-cp27-cp27m-win_amd64.whl
Size 381.0 kB
Tags CPython 2.7 CPython 2.7 pymalloc Windows x86-64
SHA-256 checksum
How to use checksums
6871bd1b69a00ca4aa3f39519846776649da7c0e25aa9ec1b9ba58931ffcb125
BLAKE2b-256 checksum
How to use checksums
e1bb402fd9c21d479fb6b7e75fac76724685782a6578945362144c4aa19acdb5
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Security for louvain 0.6.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page