Skip to content

Commit

Permalink
Fix transition table memory bug
Browse files Browse the repository at this point in the history
  • Loading branch information
softwaresale committed Aug 6, 2024
1 parent 7e6be20 commit 5652180
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/main/java/dk/brics/automaton/TransitionTable.java
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,12 @@ public TransitionTable(Automaton auto) {
traversalQueue.add(auto.getInitialState());
while (!traversalQueue.isEmpty()) {
State state = traversalQueue.remove();

// skip states that have already been visited to keep traversal queue from growing unbounded-ly
if (visitedStates.contains(state)) {
continue;
}

if (state.isAccept()) {
acceptStates.add(state.number);
}
Expand Down

0 comments on commit 5652180

Please sign in to comment.