### What problem does this PR solve?

close issue #5600 

### Type of change

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

Signed-off-by: yihong0618 <zouzou0208@gmail.com>
This commit is contained in:
yihong 2025-03-05 11:10:04 +08:00 committed by GitHub
parent 76e8285904
commit 148a7e7002
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -104,11 +104,14 @@ class EntityResolution(Extractor):
connect_graph = nx.Graph()
removed_entities = []
connect_graph.add_edges_from(resolution_result)
# for issue #5600
all_relationships_data = []
for sub_connect_graph in nx.connected_components(connect_graph):
sub_connect_graph = connect_graph.subgraph(sub_connect_graph)
remove_nodes = list(sub_connect_graph.nodes)
keep_node = remove_nodes.pop()
self._merge_nodes(keep_node, self._get_entity_(remove_nodes))
await self._merge_nodes(keep_node, self._get_entity_(remove_nodes), all_relationships_data=all_relationships_data)
for remove_node in remove_nodes:
removed_entities.append(remove_node)
remove_node_neighbors = graph[remove_node]