Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix of the performance bug in get_useful_states #351

Merged
merged 2 commits into from
Sep 28, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions src/nfa/nfa.cc
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
#include <algorithm>
#include <list>
#include <optional>
#include <unordered_set>
#include <iterator>

// MATA headers
Expand Down Expand Up @@ -329,7 +328,11 @@ BoolVector Nfa::get_useful_states(bool stop_at_first_useful_state) const {
// propagate usefulness to the closed SCC
for(const State& st : scc) useful[st] = true;
// propagate usefulness to predecessors in @p tarjan_stack
for(const State& st : tarjan_stack) useful[st] = true;
for (auto st = tarjan_stack.rbegin(); st != tarjan_stack.rend(); ++st) {
if (useful[*st])
break;
useful[*st] = true;
}
}
}
// all successors have been processed, we can remove act_state from the program stack
Expand Down
Loading