RagLeap
Blog

ragleap-graph 0.10.0: deterministic community detection for a RAG knowledge graph on Neo4j

ragleap-graph adds knowledge-graph retrieval to a RAG system: entity extraction, co-occurrence graphs and graph-based document retrieval through Neo4j. Version 0.10.0 adds deterministic community detection. Source: its README and changelog at the 0.10.0 tag.

What is ragleap-graph?

A Python library, installed with pip install ragleap-graph, that stores entities and documents in Neo4j. The default entity extraction is regex and heuristics (fast, free, no dependencies). For messier input, method="llm" extraction and dedup need the llm extra and a model provider you configure.

How do I use it?

This is the README quickstart:

from ragleap_graph import GraphConfig, GraphIndex

graph = GraphIndex(config=GraphConfig(
    uri="bolt://localhost:7687",
    user="neo4j",
    password="...",
))

graph.upsert_document(
    document_id="doc-1",
    title="Q3 Report",
    chunks=[{"text": "Acme Corp reported strong Q3 revenue growth."}],
)

docs = graph.find_documents_by_entities(["Acme Corp"])
related = graph.search_related_entities(["Acme Corp"], max_depth=2)

What are communities in 0.10.0?

  • detect_communities(edges, resolution=1.0, min_size=2) runs Louvain modularity optimisation on weighted undirected edges, then splits every community into its connected parts. It returns the members, size, internal weight and a members hash for each community.
  • It uses no random numbers, so the same edges always give the same communities. It is not Leiden and gives one flat level, and modularity has a resolution limit. Neo4j Community has no Graph Data Science plugin, which is why this runs in the library.
  • GraphIndex.detect_communities(), refresh_communities() and find_communities() work on the stored co-occurrence graph and store :Community nodes with :IN_COMMUNITY edges.
  • Summaries come from a function you pass in (summarizer(info) -> str). They are written only for new communities, communities without a summary, or with force=True; a failing summarizer is counted, not raised; they are capped at 20000 characters; no model is bundled.
  • Community lookup in retrieval is opt-in: GraphRetrievalConfig.include_communities defaults to False, and max_communities to 3. With the default, results are unchanged.
  • Do not refresh the same namespace from two places at once.

What are the known limits?

  • EntityDeduplicator merges spelling variants of an already-extracted name. It does not fix a real-world entity being split into several candidates by the regex extractor.
  • Cross-chunk relation extraction (cross_chunk_relations=True) depends on the provider’s reasoning. The README says it was live-verified with Gemini, and that a small local model (qwen2.5:0.5b) produced an incorrect relation rather than none, so check its output before relying on it.

How was it tested?

Our Tests page counts 9 test files and 178 test functions on the main branch (a count, not a pass count). The verification notes for 0.10.0 are in the release notes.

More: the library page and the source.

Back to the blog