If the iterator of an FA has a trap state (a state that cannot reach or is not a final state but has outgoing transitions) and that trap states can reach itself, then the shortestAcceptingPathwill loop forever.
However, forever may not be too long since it will continuously consume memory, quickly reaching the memory limit of the JS runtime.
If the iterator of an FA has a trap state (a state that cannot reach or is not a final state but has outgoing transitions) and that trap states can reach itself, then the
shortestAcceptingPath
will loop forever.However, forever may not be too long since it will continuously consume memory, quickly reaching the memory limit of the JS runtime.