question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

(NFA) InvalidStateError: end state q for transition on q0 is not valid

See original GitHub issue

hey i ve getting this error while using “nfa.accepts_input(my_input_str)” in my project , i tried the same structure of the automata in a seperate file and it functionned properly , im wondering if anyone could guide me a little to figure out what to fix ( or at least the scenarios that may lead to this error thanks! here’s my project link https://github.com/maryembenali/automata.git

automata.base.exceptions.InvalidStateError: end state q for transition on q0 is not valid

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
caleb531commented, Aug 17, 2022

@maryembenali Perfect, I was able to reproduce the error. I’m pasting it here so I can reference it later:

Exception in Tkinter callback
Traceback (most recent call last):
  File "/opt/homebrew/Cellar/python@3.9/3.9.13_1/Frameworks/Python.framework/Versions/3.9/lib/python3.9/tkinter/__init__.py", line 1892, in __call__
    return self.func(*args)
  File "/Users/caleb/Desktop/automata-trial2/trial2.py", line 127, in Verify_Word
    nfa = NFA(states=set(States),input_symbols=set(Letters_List),transitions=Transitions_Dict,initial_state=Initial_state[0],final_states=set(final_states))
  File "/Users/caleb/Desktop/automata-trial2/.virtualenv/lib/python3.9/site-packages/automata/fa/nfa.py", line 21, in __init__
    self.validate()
  File "/Users/caleb/Desktop/automata-trial2/.virtualenv/lib/python3.9/site-packages/automata/fa/nfa.py", line 70, in validate
    self._validate_transition_end_states(start_state, paths)
  File "/Users/caleb/Desktop/automata-trial2/.virtualenv/lib/python3.9/site-packages/automata/fa/nfa.py", line 62, in _validate_transition_end_states
    raise exceptions.InvalidStateError(
automata.base.exceptions.InvalidStateError: end state q for transition on q0 is not valid

I will start debugging later today or tomorrow. I need to take a break right now.

1reaction
maryembenalicommented, Aug 17, 2022

@caleb531
These are the inputs i tried to enter

  • tick non-deterministic (doesn’t do anything for the moment)
  • 2
  • a b
  • 3
  • {“q0”: {“a”: “q1”}, “q1”: {“a”: “q1”, “b”: “q2”},“q2”: {“b”: “q0”}}
  • q0
  • 1
  • q1 Also i recommend to change the path of the image so it can be displayed properly Thank u very much!
Read more comments on GitHub >

github_iconTop Results From Across the Web

automata-lib 1.0.0.post3 - PyPI
The method returns True if the DFA is valid; otherwise, it will raise the appropriate exception (e.g. the state transition is missing for...
Read more >
What does an NFA do if there's no transition with the correct ...
In a DFA, if you are in state p and see an input character c, one of three things may happen: You can...
Read more >
Chapter Five: Nondeterministic Finite Automata
A DFA has exactly one transition from every state on ... An NFA can make a state transition ... No moves, ending in...
Read more >
q1 q2 q3 a b b a a, b - NJIT
F ⊆ Q is the set of accept states (or final states). Remark: Sometimes refer to DFA as simply a finite automaton (FA)....
Read more >
Theory of Computation - (Finite Automata)
Solution. The DFA accepts the string bbab. The computation is: 1. Start in state q0. 2. Read b, follow transition from q0 to...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found