Skip to main content
QUICK REVIEW

[Paper Review] Faster unfolding of communities: speeding up the Louvain algorithm

Vincent Traag|Data Archiving and Networked Services (DANS)|Mar 4, 2015
Complex Network Analysis TechniquesPhysics and Astronomy10 citations
TL;DR

This paper proposes the random neighbor Louvain algorithm, a simple modification to the Louvain community detection method that selects nodes to move to a random neighbor community instead of the best neighbor. This change reduces theoretical runtime complexity from 𝒪(m) to 𝒪(n log⟨k⟩), speeding up the algorithm 2–3 times on benchmark networks and up to 10× on real networks, with only a minor trade-off in modularity quality, especially effective for modularity-based optimization.

ABSTRACT

Many complex networks exhibit a modular structure of densely connected groups of nodes. Usually, such a modular structure is uncovered by the optimization of some quality function. Although flawed, modularity remains one of the most popular quality functions. The Louvain algorithm was originally developed for optimizing modularity, but has been applied to a variety of methods. As such, speeding up the Louvain algorithm, enables the analysis of larger graphs in a shorter time for various methods. We here suggest to consider moving nodes to a random neighbor community, instead of the best neighbor community. Although incredibly simple, it reduces the theoretical runtime complexity from $\mathcal{O}(m)$ to $\mathcal{O}(n \log \langle k angle)$ in networks with a clear community structure. In benchmark networks, it speeds up the algorithm roughly 2-3 times, while in some real networks it even reaches 10 times faster runtimes. This improvement is due to two factors: (1) a random neighbor is likely to be in a "good" community; and (2) random neighbors are likely to be hubs, helping the convergence. Finally, the performance gain only slightly diminishes the quality, especially for modularity, thus providing a good quality-performance ratio. However, these gains are less pronounced, or even disappear, for some other measures such as significance or surprise.

Motivation & Objective

  • To address the high computational cost of the Louvain algorithm on large networks, especially when optimizing modularity.
  • To improve runtime efficiency without significantly degrading the quality of detected communities.
  • To explore whether random neighbor selection could outperform the standard best-neighbor search in terms of speed and convergence.
  • To evaluate the performance of the modified algorithm across different quality functions, including modularity, significance, and surprise.
  • To assess the scalability and robustness of the random neighbor approach on both synthetic and real-world networks.

Proposed method

  • Replace the standard Louvain step of moving nodes to the best neighboring community with selecting a random neighbor community instead.
  • Use random neighbor selection to exploit the likelihood that hubs or well-connected nodes are in high-quality communities.
  • Theoretical analysis shows the new method reduces time complexity from 𝒪(m) to 𝒪(n log⟨k⟩), where n is the number of nodes and ⟨k⟩ is the average degree.
  • The algorithm maintains the same iterative two-level structure: local optimization followed by network aggregation.
  • The method is applied to modularity, significance, and surprise, with performance evaluated on benchmark and real-world networks.
  • Weighted networks are explored by testing sampling proportional to edge weights, though benefits are limited and preprocessing costs may offset gains.

Experimental results

Research questions

  • RQ1Can replacing the best-neighbor search with random neighbor selection significantly reduce the runtime of the Louvain algorithm?
  • RQ2Does the random neighbor approach maintain sufficient community quality, especially for modularity-based optimization?
  • RQ3How does the performance gain vary across different quality functions such as modularity, significance, and surprise?
  • RQ4To what extent does the algorithm’s speedup depend on network structure, such as community density and degree distribution?
  • RQ5Can the random neighbor strategy be generalized to other community detection algorithms like label propagation?

Key findings

  • The random neighbor Louvain algorithm reduces theoretical time complexity from 𝒪(m) to 𝒪(n log⟨k⟩), making it nearly linear in the number of nodes rather than edges.
  • On benchmark networks, the algorithm runs 2–3 times faster than the original Louvain, with speedups up to 10× on certain real-world networks.
  • The performance gain is most pronounced for modularity, where the algorithm maintains high-quality partitions with only a minor drop in modularity score.
  • For significance and surprise, the speedup is less effective due to the preference for finer, smaller communities, reducing the benefit of random neighbor selection.
  • Weighted sampling based on edge weights provides only marginal improvement and is not consistently better than unweighted random sampling.
  • The method is robust across network sizes and structures, with consistent speedups observed in both synthetic and empirical networks.

Read this paper

Open the full text in the Nubint reader and ask about any passage as you read.

Read this paper on Nubint

This review was generated by AI from the original paper. Please check the paper before citing it.