Skip to content

Commit

Permalink
nested if
Browse files Browse the repository at this point in the history
  • Loading branch information
koniksedy committed Dec 3, 2024
1 parent 8f8b3cf commit f84c984
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions src/nfa/operations.cc
Original file line number Diff line number Diff line change
Expand Up @@ -967,10 +967,12 @@ Nfa mata::nfa::minimize(const Nfa &dfa, const ParameterMap& params)
}

// Hopcroft algorithm does not work with non-trimmed automata.
const BoolVector is_used = dfa.get_useful_states();
bool is_trimmed = std::all_of(is_used.begin(), is_used.end(), [](bool b) { return b; });
if (str_algo == "hopcroft" && !is_trimmed) {
return algo(Nfa(dfa).trim());
if (str_algo == "hopcroft") {
const BoolVector is_used = dfa.get_useful_states();
bool is_trimmed = std::all_of(is_used.begin(), is_used.end(), [](bool b) { return b; });
if (!is_trimmed) {
return algo(Nfa(dfa).trim());
}
}
return algo(dfa);
}
Expand Down

0 comments on commit f84c984

Please sign in to comment.