Algorithms Library Toolkit
A toolkit for algorithms, especially for algorithms on formal languages
NondeterministicExactSuffixEpsilonAutomaton.h
Go to the documentation of this file.
1
6/*
7 * Author: Radovan Cerveny
8 */
9
10#pragma once
11
13#include <string/LinearString.h>
14
15namespace stringology {
16
17namespace indexing {
18
20public:
25 template < class SymbolType >
27
28};
29
30template < class SymbolType >
33
34 nfaSuffixAutomaton.setInputAlphabet ( pattern.getAlphabet ( ) );
35
36 unsigned i = 0;
37 for ( const SymbolType & symbol : pattern.getContent ( ) ) {
38 nfaSuffixAutomaton.addState ( ++ i );
39 nfaSuffixAutomaton.addTransition ( i - 1, symbol, i );
40 nfaSuffixAutomaton.addTransition ( 0, i );
41 }
42
43 nfaSuffixAutomaton.addFinalState ( i );
44
45 return nfaSuffixAutomaton;
46}
47
48} /* namespace indexing */
49
50} /* namespace stringology */
51
Epsilon nondeterministic finite automaton. Accepts regular languages.
Definition: EpsilonNFA.h:74
bool addTransition(StateType from, common::symbol_or_epsilon< SymbolType > input, StateType to)
Add a transition to the automaton.
Definition: EpsilonNFA.h:604
void setInputAlphabet(ext::set< SymbolType > symbols)
Definition: EpsilonNFA.h:294
bool addFinalState(StateType state)
Definition: EpsilonNFA.h:227
bool addState(StateType state)
Definition: EpsilonNFA.h:178
Linear string.
Definition: LinearString.h:57
const ext::set< SymbolType > & getAlphabet() const &
Definition: LinearString.h:103
const ext::vector< SymbolType > & getContent() const &
Definition: LinearString.h:238
Definition: NondeterministicExactSuffixEpsilonAutomaton.h:19
static automaton::EpsilonNFA< SymbolType, unsigned > construct(const string::LinearString< SymbolType > &pattern)
Definition: NondeterministicExactSuffixEpsilonAutomaton.h:31
int i
Definition: AllEpsilonClosure.h:118
typename T::SymbolType SymbolType
Definition: ReachableStates.h:176
Definition: ArithmeticCompression.h:18