Conversion of NFA to RE
Theory
Non-Deterministic Finite Automata(NFA)
NFA (Non-Deterministic Finite Automata) is a state machine used to validate an input string using state transitions. In NFA, multiple paths can exist from the current state to the next state for an input symbol.
Regular Expressions
Regular expressions are a sequence of characters that are used to check if the given string follows the pattern or not.
There are two main methods for converting a given NFA to a regular expression:
1. State Elimination Method
2. Arden's Theorem Method
State elimination Method
Step -1
If there are incoming transitions to the initial state:
Step-2:
If there are outgoing transitions from the final state:
Step-3:
If the automaton has multiple final states:
Step-4:
Eliminate all the states one by one except initial state and final state to get the final result which is the regular expression for the given NFA