catch networkx error (#1201)

This commit is contained in:
Harrison Chase 2023-02-20 21:43:02 -08:00 committed by GitHub
parent 44c8d8a9ac
commit fb83cd4ff4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -50,7 +50,13 @@ class NetworkxEntityGraph:
def __init__(self) -> None:
"""Create a new graph."""
import networkx as nx
try:
import networkx as nx
except ImportError:
raise ValueError(
"Could not import networkx python package. "
"Please it install it with `pip install networkx`."
)
self._graph = nx.DiGraph()