Browse/Neo4j & Knowledge Graphs/Community Detection with Neo4j GDS and Leiden Algorithm

Community Detection with Neo4j GDS and Leiden Algorithm

How to implement hierarchical community detection using Neo4j GDS and the Leiden algorithm.

Neo4j GDS Documentation2024

The Leiden algorithm is preferred for GraphRAG. Implementation: 1) Project graph with gds.graph.project, 2) Run Leiden with gds.leiden.write including maxLevels and gamma parameters, 3) Query communities. Key parameters: gamma controls granularity (higher = smaller communities), maxLevels controls hierarchy depth. Leiden improves on Louvain by guaranteeing well-connected communities.

Tags

community-detectionleidengdsneo4jhierarchical