fix: adds back the ids to the nodes after node_link_graph

This commit is contained in:
hajdul88 2024-12-04 18:14:08 +01:00
parent 080143cdad
commit f444ae21b4

View file

@ -274,6 +274,9 @@ class NetworkXAdapter(GraphDBInterface):
edge["updated_at"] = datetime.strptime(edge["updated_at"], "%Y-%m-%dT%H:%M:%S.%f%z")
self.graph = nx.readwrite.json_graph.node_link_graph(graph_data)
for node_id, node_data in self.graph.nodes(data=True):
node_data['id'] = node_id
else:
# Log that the file does not exist and an empty graph is initialized
logger.warning("File %s not found. Initializing an empty graph.", file_path)