Performance Fix
Louvain community detection: 297x faster — fixes O(N²) bottleneck that caused indexing timeouts on large codebases.
What changed
- Replaced naive
modularityGain(scanned all nodes per call) with per-communitycommSumTotaccumulators maintained incrementally - Each Louvain iteration is now O(m) instead of O(N²)
Benchmarks (Django, ~30K nodes, ~48K CALLS edges)
| Metric | v0.3.3 | v0.3.4 |
|---|---|---|
| Communities pass | 4m 40s | 0.94s |
| Total indexing | 5m 38s | 24s |
Graph output (nodes, edges, community assignments) is equivalent — only speed changed.