From 058b5916a49dc7eac6538b206d8cb694a2fbc163 Mon Sep 17 00:00:00 2001 From: Leon Luithlen Date: Mon, 11 Nov 2024 12:59:36 +0100 Subject: [PATCH] Remove graph overwriting on exception in NetworkXAdapter --- cognee/infrastructure/databases/graph/networkx/adapter.py | 8 -------- 1 file changed, 8 deletions(-) diff --git a/cognee/infrastructure/databases/graph/networkx/adapter.py b/cognee/infrastructure/databases/graph/networkx/adapter.py index 19bd50051..5fe97e94a 100644 --- a/cognee/infrastructure/databases/graph/networkx/adapter.py +++ b/cognee/infrastructure/databases/graph/networkx/adapter.py @@ -267,14 +267,6 @@ class NetworkXAdapter(GraphDBInterface): await self.save_graph_to_file(file_path) except Exception: logger.error("Failed to load graph from file: %s", file_path) - # Initialize an empty graph in case of error - self.graph = nx.MultiDiGraph() - - file_dir = os.path.dirname(file_path) - if not os.path.exists(file_dir): - os.makedirs(file_dir, exist_ok = True) - - await self.save_graph_to_file(file_path) async def delete_graph(self, file_path: str = None): """Asynchronously delete the graph file from the filesystem."""