Skip to content

Commit

Permalink
got through stack backward only until the first useful
Browse files Browse the repository at this point in the history
  • Loading branch information
kilohsakul committed Sep 28, 2023
1 parent 025f56a commit 580b899
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/nfa/nfa.cc
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
#include <optional>
#include <unordered_set>
#include <iterator>
#include <ranges>

// MATA headers
#include "mata/utils/sparse-set.hh"
Expand Down Expand Up @@ -329,7 +330,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(const State& st :std::views::reverse(tarjan_stack)) {
if (useful[st])
break;
useful[st] = true;
}
}
}
// all successors have been processed, we can remove act_state from the program stack
Expand Down

0 comments on commit 580b899

Please sign in to comment.