Build Status CRAN status CRAN downloads


Implements the Leiden algorithm via an R interface


The Leiden algorithm is an iterative community detection algorithm on networks—the algorithm is designed to converge to a partition in which all subsets of all communities are locally optimally assigned, yielding communities guaranteed to be connected.

The algorithm was written to improve upon defects of the Louvain algorithm. Consequently, the Leiden algorithm is faster, scales well, and can be run on graphs of millions of nodes (as long as they can fit in memory).

The basic steps are: * (1) local moving of nodes to quickly find partitions * (2) refinement of partitions * (3) aggregation of the network based on the refined partition, using the non-refined partition to create an initial partition for the aggregate network. Steps are iterated until convergence.

For details on the algorithm, see “From Louvain to Leiden: guaranteeing well-connected communities” Traag, Waltman, van Eck. Sci Rep 9, 5233 (2019).

For the original implementation in C++ with python bindings, see:


To install the stable version from CRAN, use:


To install the latest version, use:

devtools::install_github('kharchenkolab/leidenAlg', build_vignettes = TRUE)



If you find leidenAlg useful for your publication, please cite:

Peter Kharchenko, Viktor Petukhov and Evan Biederstedt (2021).
leidenAlg: Implements the Leiden Algorithm via an R Interface. R
package version 0.1.1.