Skip to content

Commit

Permalink
fix: adds back the ids to the nodes after node_link_graph
Browse files Browse the repository at this point in the history
  • Loading branch information
hajdul88 committed Dec 4, 2024
1 parent 080143c commit f444ae2
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions cognee/infrastructure/databases/graph/networkx/adapter.py
Original file line number Diff line number Diff line change
Expand Up @@ -274,6 +274,9 @@ async def load_graph_from_file(self, file_path: str = None):
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)
Expand Down

0 comments on commit f444ae2

Please sign in to comment.