Algorithms Library Toolkit
A toolkit for algorithms, especially for algorithms on formal languages
ExactNondeterministicSubsequenceAutomaton.h
Go to the documentation of this file.
1
6#pragma once
7
9#include <string/LinearString.h>
10
11namespace stringology {
12
13namespace indexing {
14
16public:
21 template < class SymbolType >
23};
24
25template < class SymbolType >
28 res.addFinalState ( 0 );
29 res.setInputAlphabet ( text.getAlphabet ( ) );
30
31 unsigned i = 1;
32 for ( const SymbolType & symbol : text.getContent ( ) ) {
33 res.addState ( i );
34 res.addFinalState( i );
35
36 res.addTransition ( i - 1, symbol, i );
37 res.addTransition ( i - 1, i );
38 i++;
39 }
40 return res;
41}
42
43} /* namespace indexing */
44
45} /* namespace stringology */
46
Epsilon nondeterministic finite automaton. Accepts regular languages.
Definition: EpsilonNFA.h:74
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: ExactNondeterministicSubsequenceAutomaton.h:15
static automaton::EpsilonNFA< SymbolType, unsigned > construct(const string::LinearString< SymbolType > &text)
Definition: ExactNondeterministicSubsequenceAutomaton.h:26
int i
Definition: AllEpsilonClosure.h:118
typename T::SymbolType SymbolType
Definition: ReachableStates.h:176
return res
Definition: MinimizeByPartitioning.h:145
Definition: ArithmeticCompression.h:18