Skip to content

Commit

Permalink
fix: use from_networkx if graph does not exist in db
Browse files Browse the repository at this point in the history
  • Loading branch information
aMahanna committed Oct 15, 2024
1 parent e9a1658 commit 993e3af
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions nx_arangodb/convert.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)}")
Expand Down

0 comments on commit 993e3af

Please sign in to comment.