Skip to content

RAGFlow is an agent-native database: a Retrieval-Augmented Generation (RAG) engine that grew into context infrastructure.

Fix duplicated communitiy (#4187)

Kevin Hub63500266664
diff --git a/graphrag/leiden.py b/graphrag/leiden.py
index 315e6ff933..f9f9b330fd 100644
--- a/graphrag/leiden.py
+++ b/graphrag/leiden.py
@@ -141,3 +141,4 @@ def add_community_info2graph(graph: nx.Graph, nodes: list[str], community_title)
if "communities" not in graph.nodes[n]:
graph.nodes[n]["communities"] = []
graph.nodes[n]["communities"].append(community_title)
+ graph.nodes[n]["communities"] = list(set(graph.nodes[n]["communities"]))