Skip to content

feat: add Leiden community detection (LEIDEN/LE) to ALGO extension#29

Closed
chiangchenghsin-hash wants to merge 5 commits into
LadybugDB:mainfrom
chiangchenghsin-hash:feat/leiden-community-detection
Closed

feat: add Leiden community detection (LEIDEN/LE) to ALGO extension#29
chiangchenghsin-hash wants to merge 5 commits into
LadybugDB:mainfrom
chiangchenghsin-hash:feat/leiden-community-detection

Conversation

@chiangchenghsin-hash

Copy link
Copy Markdown
Contributor

Summary

Adds Leiden community detection algorithm (CALL leiden(...)) and its alias (CALL le(...)) to the ALGO extension.

Features

  • CALL leiden('projection') RETURN node, community_id — Leiden algorithm
  • CALL le('projection') RETURN node, community_id — Short alias
  • Same GDS pipeline as louvain (GDSFunction::initSharedState, getLogicalPlan, getPhysicalPlan)

Files

  • src/include/function/leiden.h (new) — Function declaration
  • src/function/leiden.cpp (new) — Implementation with LeidenGraph, MoveNodesFast, GDSResultVertexCompute pipeline
  • src/main/algo_extension.cpp (edit) — Register LeidenFunction + LeidenAliasFunction
  • src/function/CMakeLists.txt (edit) — Add leiden.cpp to build

Algorithm

Independent C++ implementation (no external dependencies). The MoveNodesFast local moving phase is implemented. The refinement and aggregation phases are scaffolded for future completion.

Verification

  • Windows 11 x64, MSVC 19.50, LadybugDB 0.18.3
  • CALL LEIDEN('G') RETURN node, community_id → returns correct community assignments
  • CALL LE('G') RETURN node, community_id → alias works
  • All existing ALGO functions continue to work (SCC, WCC, PR, KCORE, LOUVAIN, SF)
  • 15/15 Node.js API tests pass

@adsharma

Copy link
Copy Markdown
Contributor

Looking to deprecate the current algo extension. Plan is to reroute the GDS functions to icebug, which already has a much more performant implementation:

https://github.com/LadybugDB/ladybug-icebug-notebooks/blob/main/ladybug_icebug_comm_detection.ipynb

@adsharma adsharma closed this Jul 23, 2026
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.

2 participants