Kevin Hu commited on
Commit
43c49ab
·
1 Parent(s): 0d51511

Fix duplicated communitiy (#4187)

Browse files

### What problem does this PR solve?

#4180

### Type of change

- [x] Bug Fix (non-breaking change which fixes an issue)

Files changed (1) hide show
  1. graphrag/leiden.py +1 -0
graphrag/leiden.py CHANGED
@@ -141,3 +141,4 @@ def add_community_info2graph(graph: nx.Graph, nodes: list[str], community_title)
141
  if "communities" not in graph.nodes[n]:
142
  graph.nodes[n]["communities"] = []
143
  graph.nodes[n]["communities"].append(community_title)
 
 
141
  if "communities" not in graph.nodes[n]:
142
  graph.nodes[n]["communities"] = []
143
  graph.nodes[n]["communities"].append(community_title)
144
+ graph.nodes[n]["communities"] = list(set(graph.nodes[n]["communities"]))