Algorithms Library Toolkit
A toolkit for algorithms, especially for algorithms on formal languages
EpsilonRemoverOutgoing.h
Go to the documentation of this file.
1
6#pragma once
7
8#include <map>
9#include <algorithm>
10
13#include <automaton/FSM/NFA.h>
14#include <automaton/FSM/DFA.h>
15
16#include "../../properties/efficient/AllEpsilonClosure.h"
17
18namespace automaton {
19
20namespace simplify {
21
22namespace efficient {
23
25public:
29 template < class StateType, class SymbolType >
31 template < class StateType, class SymbolType >
33 template < class StateType, class SymbolType >
35 template < class StateType, class SymbolType >
37};
38
39template < class StateType, class SymbolType >
41 return fsm;
42}
43
44template < class StateType, class SymbolType >
46 return fsm;
47}
48
49template < class StateType, class SymbolType >
51 return fsm;
52}
53
54template < class StateType, class SymbolType >
57 res.setStates ( fsm.getStates ( ) );
58 res.setFinalStates ( fsm.getFinalStates ( ) );
59 res.setInputAlphabet ( fsm.getInputAlphabet ( ) );
60
62
64
65 for ( const std::pair < const ext::pair < StateType, SymbolType >, StateType > & transition : transitions )
66 for ( const StateType & toClosure : closures [ transition.second ] )
67 res.addTransition ( transition.first.first, transition.first.second, toClosure );
68
72 const ext::set < StateType > & cl = closures [ fsm.getInitialState ( ) ];
73 res.setInitialStates ( cl );
74
75 return res;
76}
77
78} /* namespace efficient */
79
80} /* namespace simplify */
81
82} /* namespace automaton */
83
Deterministic finite automaton. Accepts regular languages.
Definition: DFA.h:71
Epsilon nondeterministic finite automaton. Accepts regular languages.
Definition: EpsilonNFA.h:74
const ext::set< StateType > & getStates() const &
Definition: EpsilonNFA.h:158
const ext::set< StateType > & getFinalStates() const &
Definition: EpsilonNFA.h:207
const ext::set< SymbolType > & getInputAlphabet() const &
Definition: EpsilonNFA.h:256
ext::multimap< ext::pair< StateType, SymbolType >, StateType > getSymbolTransitions() const
Definition: EpsilonNFA.h:687
const StateType & getInitialState() const &
Definition: EpsilonNFA.h:129
Nondeterministic finite automaton with multiple initial states. Accepts regular languages.
Definition: MultiInitialStateNFA.h:69
Nondeterministic finite automaton. Accepts regular languages.
Definition: NFA.h:66
static ext::map< StateType, ext::set< StateType > > allEpsilonClosure(const automaton::EpsilonNFA< SymbolType, StateType > &fsm)
Definition: AllEpsilonClosure.h:61
Definition: EpsilonRemoverOutgoing.h:24
static automaton::MultiInitialStateNFA< SymbolType, StateType > remove(const automaton::EpsilonNFA< SymbolType, StateType > &fsm)
Definition: EpsilonRemoverOutgoing.h:55
Class extending the map class from the standard library. Original reason is to allow printing of the ...
Definition: map.hpp:48
Class extending the multimap class from the standard library. Original reason is to allow printing of...
Definition: multimap.hpp:48
Class extending the pair class from the standard library. Original reason is to allow printing of the...
Definition: pair.hpp:43
Definition: set.hpp:44
typename T::StateType StateType
Definition: ToGrammarLeftRG.h:64
return res
Definition: MinimizeByPartitioning.h:145
Definition: ToGrammar.h:31