Closed irisdyoung closed 5 months ago
This is expected behavior. The transition dictionary for NFAs ends on a set of states rather than a single state (the weird error message is because it's iterating through the string for the state name the way it would a set). The reason for this has to do with how these objects are defined mathematically. This difference is present in the API documentation, but we can add an example of an NFA defined by hand to the first example.
To directly create an NFA equivalent to an input DFA, you can use the NFA.from_dfa
method.
Related to review: https://github.com/pyOpenSci/software-submission/issues/152
Closing this issue as per @eliotwrobson's comment, this is the expected behavior.
When working through the examples I tried instantiating some NFAs as we had previously done for DFAs, and the same example inputs aren't valid. After trying a few more cases, it looks to me like NFAs will only accept state identifiers one character long, and more specifically they seem to be truncating end states to the first character during instantiation. For example, this example worked for a DFA:
but not for an NFA:
This latter one reports
InvalidStateError: end state 0 for transition on 00 is not valid
Acknowledging that I'm out of my depth subject-matter-wise, this looks like a bug to me. I'm running the latest command line version in python 3.12.3 on a mac.