26#include <ext/algorithm>
59 template <
class SymbolType >
109 template <
class SymbolType >
113template <
class SymbolType >
116 return RandomTreeAutomatonFactory::LeslieConnectedNFTA ( statesCount, alphabet2, density );
119template <
class SymbolType >
126 if ( symbol.getRank ( ) == 0 )
127 nullaryAlphabet.push_back ( symbol );
129 if ( nullaryAlphabet.empty ( ) )
140 for(
size_t i = 0;
i < n;
i ++ ) {
141 VStates.push_back(
false );
148 }
else if( n == 1 ) {
159 size_t unvisited = n - 1;
161 while( unvisited != 0 ) {
164 while ( from.size ( ) <
alphabet [ c ].getRank ( ) ) {
166 from.push_back ( Q[ a ] );
177 for(
const unsigned &
q : Q ) {
184 if(
automaton.getFinalStates( ).empty ( ) ) {
188 for(
const unsigned &
q : Q ) {
189 if(
automaton.getTransitionsFromState(
q ).empty ( ) ) {
197 size_t accSourceStates = 1;
199 accSourceStates += symbol.getRank ( );
201 double mnn100 = 100.0 /
alphabet.size( ) / accSourceStates / n;
202 while(
automaton.getTransitions ( ).size ( ) * mnn100 < density ) {
205 while ( from.size ( ) <
alphabet [ a ].getRank ( ) ) {
207 from.push_back ( Q[ y ] );
216 for (
const auto & t :
automaton.getTransitions( ) )
217 alphabetUsage.erase ( t.first.first );
219 for (
const auto & kv : alphabetUsage )
Nondeterministic finite tree automaton without epsilon transitions. Accepts regular tree languages.
Definition: NFTA.h:72
Definition: RandomTreeAutomatonFactory.h:47
static automaton::NFTA< SymbolType, unsigned > generateNFTA(size_t statesCount, const ext::set< common::ranked_symbol< SymbolType > > &alphabet, double density)
Definition: RandomTreeAutomatonFactory.h:114
Definition: ranked_symbol.hpp:20
Basic exception from which all other exceptions are derived.
Definition: CommonException.h:21
Class extending the deque class from the standard library. Original reason is to allow printing of th...
Definition: deque.hpp:44
static semirandom_device & semirandom
The reference to singleton semirandom device.
Definition: random.hpp:147
Class extending the vector class from the standard library. Original reason is to allow printing of t...
Definition: vector.hpp:45
Definition: BarSymbol.cpp:12
int i
Definition: AllEpsilonClosure.h:118
q
Definition: SingleInitialStateEpsilonTransition.h:85
Definition: ToGrammar.h:31