Here we have a DFA like this:
Is this already a minimized DFA or should we minimize it using Hopcroft algorithm by grouping all accepted states in one class and output:
Here we have a DFA like this:
Is this already a minimized DFA or should we minimize it using Hopcroft algorithm by grouping all accepted states in one class and output:
The Hopcroft minimisation algorithm assumes a complete DFA, in which every state has a transition on every symbol in the alphabet.
It's common to use incomplete DFAs, in which missing transitions are allowed. Technically, this an NFA (although it's fully deterministic). Unlike a DFA, an NFA allows an alphabet symbol to produce a set of possible transitions from a given state, and that set could be empty, in which case the NFA halts. (A DFA only halts when the end of input is reached.)
For the purpose of minimisation, it's usual to add a non-accepting "sink" state which has a transition to itself on every input symbol. All "missing" transitions can then be replaced by a transition to the sink state, making the automaton complete. (In practice, of course, one would prefer to use the automaton which halts immediately on invalid input rather than spinning uselessly in the sink state until the end of input. After minimization, the sink state can be removed.)
With that convention, your DFA does not only have accepting states; there is one (implicit) non-accepting state. If the DFA really only had accepting states, then it would recognize Σ* and could indeed be minimized to a single accepting state.
Hopcroft's algorithm runs in time O(sN log N) where s
is the size of the alphabet and N
is the number of states. Since the DFA is assumed to be complete, sn
is also the number of edges in the automaton's graph (every state must have s
transitions), so we could write that as O(E log N). But if we relax the requirement that the DFA be complete, its graph will probably have considerably fewer edges, albeit only by a constant factor (if we take the alphabet size to be constant). There have been several proposals of algorithms which attempt to take advantage of this fact. See, for example, Marie-Pierre Béal, Maxime Crochemore. Minimizing incomplete automata. Finite-State Methods
and Natural Language Processing (FSMNLP’08), 2008, United States. pp.9-16, 2008, Joint Research
Centre.