diff --git a/skimage/graph/rag.py b/skimage/graph/rag.py index fc4a1aaa..7c1b7f07 100644 --- a/skimage/graph/rag.py +++ b/skimage/graph/rag.py @@ -1,11 +1,13 @@ try: import networkx as nx except ImportError: + msg = "Graph functions require networkx, which is not installed" class nx: class Graph: - pass + def __init__(self, *args, **kwargs): + raise ImportError(msg) import warnings - warnings.warn('Region Adjacency Graph (RAG) features require networkx') + warnings.warn(msg) import numpy as np from scipy.ndimage import filters from scipy import ndimage as nd