Skip to content

Commit 481cada

Browse files
committed
More precise system balance checking
1 parent 9749e37 commit 481cada

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/structural_transformation/utils.jl

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,8 +46,9 @@ end
4646
function check_consistency(state::TearingState, ag = nothing)
4747
fullvars = state.fullvars
4848
@unpack graph, var_to_diff = state.structure
49-
n_highest_vars = count(v -> length(outneighbors(var_to_diff, v)) == 0 &&
50-
(ag === nothing || !haskey(ag, v)),
49+
n_highest_vars = count(v -> var_to_diff[v] === nothing &&
50+
!isempty(𝑑neighbors(graph, v)) &&
51+
(ag === nothing || !haskey(ag, v) || ag[v] != v),
5152
vertices(var_to_diff))
5253
neqs = nsrcs(graph)
5354
is_balanced = n_highest_vars == neqs

0 commit comments

Comments
 (0)