diff --git a/spot/twaalgos/toparity.cc b/spot/twaalgos/toparity.cc index 37cf999f9..3688a6983 100644 --- a/spot/twaalgos/toparity.cc +++ b/spot/twaalgos/toparity.cc @@ -833,19 +833,21 @@ const std::vector& states, std::map>& partial_history, state_2_car_scc& state_2_car) { - for (unsigned current_state : states) - for (auto& edge : aut->out(current_state)) - { - unsigned - src = edge.src, - dst = edge.dst; - if (src == dst) - continue; - unsigned dst_scc = num2car[dst].state_scc; - auto cant_change = partial_history[aut->edge_number(edge)]; - edge.dst = state_2_car.get_sub_tree(cant_change, dst_scc) - ->get_end(true); - } + for (auto& edge : aut->edges()) + { + unsigned + src = edge.src, + dst = edge.dst; + // We don't change loops or transitions that were not created in + // the current SCC. + if (src == dst + || std::find(states.begin(), states.end(), src) == states.end()) + continue; + unsigned dst_scc = num2car[dst].state_scc; + auto cant_change = partial_history[aut->edge_number(edge)]; + edge.dst = state_2_car.get_sub_tree(cant_change, dst_scc) + ->get_end(true); + } } unsigned diff --git a/spot/twaalgos/toparity.hh b/spot/twaalgos/toparity.hh index 055711551..fb4984342 100644 --- a/spot/twaalgos/toparity.hh +++ b/spot/twaalgos/toparity.hh @@ -63,9 +63,9 @@ namespace spot /// Only allow degeneralization if it reduces the number of colors in the /// acceptance condition. bool reduce_col_deg = false; - /// Use propagate_marks_here to increase the number of marks on transition in - /// order to move more colors (and increase the number of compatible states) - /// when we apply LAR. + /// Use propagate_marks_here to increase the number of marks on transition + /// in order to move more colors (and increase the number of + /// compatible states) when we apply LAR. bool propagate_col = true; /// If \a pretty_print is true, states of the output automaton are /// named to help debugging. diff --git a/tests/python/merge.py b/tests/python/merge.py index 161b9b6fd..a33a2774f 100644 --- a/tests/python/merge.py +++ b/tests/python/merge.py @@ -78,7 +78,8 @@ assert hoa == """HOA: v1 States: 3 Start: 0 AP: 2 "a" "b" -Acceptance: 2 Fin(1) | Inf(0) +acc-name: parity min even 2 +Acceptance: 2 Inf(0) | Fin(1) properties: trans-labels explicit-labels trans-acc --BODY-- State: 0 diff --git a/tests/python/toparity.py b/tests/python/toparity.py index 95c01ad61..d06a72206 100644 --- a/tests/python/toparity.py +++ b/tests/python/toparity.py @@ -288,7 +288,7 @@ State: 4 [0&!1] 4 [0&1] 4 {1 2 4} --END-- -"""), [9, 6, 6, 6, 7, 6, 6]) +"""), [9, 6, 7, 7, 6, 6, 6]) test(spot.automaton(""" HOA: v1