Skip to content

Commit

Permalink
improved check before solve
Browse files Browse the repository at this point in the history
  • Loading branch information
elphick committed Jan 25, 2025
1 parent 74fc76d commit fbafc66
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions elphick/geomet/flowsheet/flowsheet.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit fbafc66

Please sign in to comment.