Question Statement: Given a NFA $N$, design an algorithm that runs in polynomial time such that it determines if $L(N)$ is infinite. (Note that converting NFA to DFA is exponential time).
For any DFA, By pumping lemma, I am very sure that the following algorithm works:
T = Upon input <M> (a DFA) Accept if any state q in DFA has the property: 1. There is a path from starting state to some final state through q 2. There is a (directed) cycle that loops from q back to q. (Reject if neither property is satisfied)
I intend to prove that this algorithm can be directly applied to NFA. After all, if there is no loop in this NFA, then every accepted string is bounded by the number of states (by pumping lemma). Therefore to make sure the NFA accepts infinite language, a loop is necessary.
Is the thinking correct? Further, what would be the optimal algorithm to see if an NFA generates infinite language?