Fix duplicated communitiy (#4187)

### What problem does this PR solve?

#4180

### Type of change

- [x] Bug Fix (non-breaking change which fixes an issue)
This commit is contained in:
Kevin Hu 2024-12-23 17:07:12 +08:00 committed by GitHub
parent 4abc144d3d
commit b635002666
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -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"]))