diff --git a/elphick/geomet/flowsheet/flowsheet.py b/elphick/geomet/flowsheet/flowsheet.py index a5341b9..fd618fc 100644 --- a/elphick/geomet/flowsheet/flowsheet.py +++ b/elphick/geomet/flowsheet/flowsheet.py @@ -15,6 +15,7 @@ import yaml from matplotlib import pyplot as plt from matplotlib.colors import ListedColormap, LinearSegmentedColormap +from networkx.algorithms.dag import is_directed_acyclic_graph from plotly.subplots import make_subplots from elphick.geomet import Sample @@ -306,6 +307,8 @@ def copy_without_stream_data(self): def solve(self): """Solve missing streams""" + assert is_directed_acyclic_graph(self.graph), "Graph is not a Directed Acyclic Graph (DAG), so cannot be solved." + # Check the number of missing mc's on edges in the network missing_count: int = sum([1 for u, v, d in self.graph.edges(data=True) if d['mc'] is None]) prev_missing_count = missing_count + 1 # Initialize with a value greater than missing_count