Skip to content

Feature : Implement Louvain Community Detection Algorithm and tests - #1287

Open
AdamBouzid0 wants to merge 15 commits into
jgrapht:masterfrom
AdamBouzid0:feat/louvain-clustering
Open

AdamBouzid0 wants to merge 15 commits into
jgrapht:masterfrom
AdamBouzid0:feat/louvain-clustering

Conversation

@AdamBouzid0

Copy link
Copy Markdown

Feature #1272

Description

This PR implements the Louvain clustering algorithm for community detection in undirected graphs.

What

  • New algorithm: LouvainClustering class implementing the Louvain method (Blondel et al., 2008)
  • Features:
    • Community detection with modularity optimization
    • Configurable resolution parameter (γ) for controlling granularity
    • Support for weighted and unweighted graphs
    • Deterministic execution with optional random seed
    • Result caching for performance

Implementation Details

  • Algorithm: Two-phase iterative approach (local moving + aggregation)
  • Package: org.jgrapht.alg.clustering

Tests

  • Empty graph handling
  • Single vertex and disconnected vertices
  • Complete graphs
  • Weighted graphs with strong/weak connections
  • Determinism with fixed seeds
  • Resolution parameter variations
  • Invalid inputs (null graph, negative resolution)

@jsichi

jsichi commented Dec 1, 2025

Copy link
Copy Markdown
Member

A couple of trivial checkstyle errors need to be fixed.

@Rayene365

Copy link
Copy Markdown

We fixed the checkstyle errors and ran the appropriate commands which were successfully executed. Thank you for your time.

@jsichi jsichi left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Your PR should not be modifying README.md. Please restore that file to the latest master version.

@Rayene365

Copy link
Copy Markdown

We restored the README.md to the latest master version. Thank you!

@jsichi

jsichi commented Feb 5, 2026

Copy link
Copy Markdown
Member

There's still one stray edit to the README.md.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants