diff --git a/alib2algo/src/arbology/exact/ExactNonlinearTreePatternAutomaton.h b/alib2algo/src/arbology/exact/ExactNonlinearTreePatternAutomaton.h index 0126575f872b64acf3265f6082a257ecb1ea26f3..290c38efdec7c0b354752749149e6759aacbb416 100644 --- a/alib2algo/src/arbology/exact/ExactNonlinearTreePatternAutomaton.h +++ b/alib2algo/src/arbology/exact/ExactNonlinearTreePatternAutomaton.h @@ -250,7 +250,6 @@ automaton::InputDrivenNPDA < common::ranked_symbol < SymbolType, RankType >, cha res.addState ( currentState ); res.addTransition ( previousState, symbol, currentState ); - res.addTransition ( res.getInitialState ( ), symbol, currentState ); if ( tree.getBars ( ).count ( symbol ) ) { ext::pair < unsigned, unsigned > source = ext::make_pair ( subtreeJumps.back ( ), 0u ); @@ -286,6 +285,8 @@ automaton::InputDrivenNPDA < common::ranked_symbol < SymbolType, RankType >, cha } else { subtreeJumps.push_back ( i - 1 ); subtreeRepeatsStack.push_back ( subtreeRepeatsIter->getSymbol ( ) ); + + res.addTransition ( res.getInitialState ( ), symbol, currentState ); } } diff --git a/alib2algo/src/arbology/exact/ExactTreePatternAutomaton.h b/alib2algo/src/arbology/exact/ExactTreePatternAutomaton.h index 2a1fd32b28ea8d3b6ad4ec63b1ddee8c0d6d0ae2..4285ab7357f8bc3f296a342c42abd1d9ad810a0d 100644 --- a/alib2algo/src/arbology/exact/ExactTreePatternAutomaton.h +++ b/alib2algo/src/arbology/exact/ExactTreePatternAutomaton.h @@ -63,7 +63,6 @@ automaton::InputDrivenNPDA < common::ranked_symbol < SymbolType, RankType >, cha for ( const common::ranked_symbol < SymbolType, RankType > & symbol : tree.getContent ( ) ) { res.addState ( i ); res.addTransition ( i - 1, symbol, i ); - res.addTransition ( 0, symbol, i ); if ( tree.getBars ( ).count ( symbol ) ) { unsigned source = subtreeJumps.back ( ); @@ -73,6 +72,8 @@ automaton::InputDrivenNPDA < common::ranked_symbol < SymbolType, RankType >, cha res.addTransition ( source, subtreeWildcard, ~0 - i ); res.addTransition ( ~0 - i, variablesBar, i ); } else { + res.addTransition ( res.getInitialState ( ), symbol, i ); // transition from the initial state only allowed for nonbar symbols + subtreeJumps.push_back ( i - 1 ); }