From b635002666648ff778b783386d9e09252bb835c0 Mon Sep 17 00:00:00 2001 From: Kevin Hu Date: Mon, 23 Dec 2024 17:07:12 +0800 Subject: [PATCH] Fix duplicated communitiy (#4187) ### What problem does this PR solve? #4180 ### Type of change - [x] Bug Fix (non-breaking change which fixes an issue) --- graphrag/leiden.py | 1 + 1 file changed, 1 insertion(+) diff --git a/graphrag/leiden.py b/graphrag/leiden.py index 315e6ff9..f9f9b330 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"]))