From 993e3affcfbf4de3ee7628f456fd2c298628c4d5 Mon Sep 17 00:00:00 2001 From: Anthony Mahanna Date: Tue, 15 Oct 2024 16:21:59 -0400 Subject: [PATCH] fix: use `from_networkx` if graph does not exist in db --- nx_arangodb/convert.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/nx_arangodb/convert.py b/nx_arangodb/convert.py index 09cfa97..8eda47b 100644 --- a/nx_arangodb/convert.py +++ b/nx_arangodb/convert.py @@ -138,11 +138,11 @@ def _to_nxcg_graph(G: Any, as_directed: bool = False) -> nxcg.Graph: return G if isinstance(G, nxadb.Graph): + logger.debug("converting nx_arangodb graph to nx_cugraph graph") + if not G.graph_exists_in_db: - m = "nx_arangodb.Graph does not exist in ArangoDB. Cannot pull graph." - raise ValueError(m) + return nxcg.convert.from_networkx(G) - logger.debug("converting nx_arangodb graph to nx_cugraph graph") return nxadb_to_nxcg(G, as_directed=as_directed) raise TypeError(f"Expected nx_arangodb.Graph or nxcg.Graph; got {type(G)}")