Expand description
Community detection on the code graph.
A hardened Leiden engine (leiden) clusters files into cohesive modules,
with robustness passes for super-hubs and oversized/low-cohesion communities
(hardening) and stable ids across rebuilds (stable_ids). The
engine is storage-agnostic: it runs on the PropertyGraph (SQLite) and on any
GraphProvider, so ctx_architecture and the dashboard graph view share
one implementation and report identical community ids.
Modules§
- graph
- Undirected, weighted adjacency representation of the file-level code graph.
- hardening
- Robustness passes layered on top of the base Leiden partition.
- leiden
- Leiden algorithm (Traag, Waltman, van Eck 2019): modularity-based clustering with a connectivity refinement pass. This implementation is deterministic — candidate communities are evaluated in ascending-id order and ties are broken towards the smaller id — so the same graph always yields the same partition, which is a prerequisite for stable community ids across rebuilds.
- stable_
ids - Stable community ids across rebuilds.
Structs§
Functions§
- detect_
communities - Detect communities on the PropertyGraph (ids are deterministic but not
remapped to a previous run). Prefer
detect_communities_stablewhen a project root is available. - detect_
communities_ for_ provider - Detect communities on any
GraphProvider(PropertyGraph or graph index) with stable ids. This is the entry point for the dashboard graph view. - detect_
communities_ stable - Detect communities on the PropertyGraph with ids kept stable across rebuilds (remapped to, and persisted alongside, the project’s previous assignment).