Fix Louvain fallback hang on large sparse graphs (#48)

This commit is contained in:
Safi
2026-04-07 22:36:45 +01:00
parent 96ea51c098
commit 3d53287ff6
3 changed files with 8 additions and 2 deletions
+4
View File
@@ -2,6 +2,10 @@
Full release notes with details on each version: [GitHub Releases](https://github.com/safishamsi/graphify/releases)
## 0.3.11 (2026-04-07)
- Fix: Louvain fallback hangs indefinitely on large sparse graphs — added `max_level=10, threshold=1e-4` to prevent infinite loops while preserving community quality (#48)
## 0.3.10 (2026-04-07)
- Fix: Windows UnicodeEncodeError during `graphify install` — replaced arrow character with `->` in all print statements (#47)
+3 -1
View File
@@ -16,7 +16,9 @@ def _partition(G: nx.Graph) -> dict[str, int]:
pass
# Fallback: networkx louvain (available since networkx 2.7)
communities = nx.community.louvain_communities(G, seed=42)
# max_level=10 and threshold=1e-4 prevent indefinite hangs on large sparse graphs
# while producing equivalent community quality to the defaults on typical corpora
communities = nx.community.louvain_communities(G, seed=42, max_level=10, threshold=1e-4)
return {node: cid for cid, nodes in enumerate(communities) for node in nodes}
+1 -1
View File
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
[project]
name = "graphifyy"
version = "0.3.10"
version = "0.3.11"
description = "AI coding assistant skill (Claude Code, Codex, OpenCode, OpenClaw) - turn any folder of code, docs, papers, or images into a queryable knowledge graph"
readme = "README.md"
license = { file = "LICENSE" }