From Louvain to Leiden: guaranteeing well-connected communities

Vincent Traag, Ludo Waltman, Nees Jan van Eck
10/19/2018
cs.SIphysics.soc-ph

Official code: vtraag/leidenalg (802 stars, GPL-3.0, last commit 2026-10-19). 1 more implementation below.

Abstract

Community detection is often used to understand the structure of large and complex networks. One of the most popular algorithms for uncovering community structure is the so-called Louvain algorithm. We show that this algorithm has a major defect that largely went unnoticed until now: the Louvain algorithm may yield arbitrarily badly connected communities. In the worst case, communities may even be disconnected, especially when running the algorithm iteratively. In our experimental analysis, we observe that up to 25% of the communities are badly connected and up to 16% are disconnected. To address this problem, we introduce the Leiden algorithm. We prove that the Leiden algorithm yields communities that are guaranteed to be connected. In addition, we prove that, when the Leiden algorithm is applied iteratively, it converges to a partition in which all subsets of all communities are locally optimally assigned. Furthermore, by relying on a fast local move approach, the Leiden algorithm runs faster than the Louvain algorithm. We demonstrate the performance of the Leiden algorithm for several benchmark and real-world networks. We find that the Leiden algorithm is faster than the Louvain algorithm and uncovers better partitions, in addition to providing explicit guarantees.

View on arXivView PDF

Code Implementations(2)

vtraag/leidenalgOfficial100%
GPL-3.0

Implementation of the Leiden algorithm for various quality functions to be used with igraph in Python.

80295C, C++Aug 30, 20183 days agoGPL-3.0
clustering-algorithmcommunity-detection
MIT

Java package that provides data structures and algorithms for network analysis.

15534JavaOct 19, 20182 years agoMIT
clusteringclustering-algorithmcommunity-detectionjavalayout+6 more

Similar Papers

Cite this paper

@article{traag2018from,
  title  = {From Louvain to Leiden: guaranteeing well-connected communities},
  author = {Vincent Traag and Ludo Waltman and Nees Jan van Eck},
  year   = {2018},
  eprint = {1810.08473},
  archivePrefix = {arXiv},
  url    = {https://arxiv.org/abs/1810.08473}
}

Add a badge to your README

Shows whether official code is linked for this paper.

Code of Paper badge
[![Code of Paper](https://codeofpaper.com/badge/1810.08473.svg)](https://codeofpaper.com/paper/1810.08473)

Discussion