17 std::string word =
"";
18 std::vector<Idx> stack;
28 std::cout <<
"found the following words while traversing at most " <<
k <<
" transitions:" << std::endl;
29 std::set<std::string>::iterator it;
30 for(it =
words.begin(); it !=
words.end(); it++){
31 std::cout << *it << std::endl;
40 std::cout<<
"Traverse("<<i<<
","<< word <<
",";
41 std::vector<Idx>::reverse_iterator stackit;
42 for(stackit = stack.rbegin(); stackit != stack.rend(); stackit++){
45 std::cout<<
"), depth " << depth <<std::endl;
51 if(word.compare(
"") == 0){
63 words.insert(word +
" ...?");
71 std::vector<Idx> pop, currentStack;
72 std::vector<Idx>::const_iterator itpush, itpop;
74 PopPushSet::const_iterator ppit;
75 std::vector<Idx>::const_reverse_iterator itstack;
82 for(ppit = popPush.begin(); ppit != popPush.end(); ppit++){
92 currentStack.insert(currentStack.end(), ppit->second.rbegin(), ppit->second.rend());
95 std::string newWord = word;
99 Traverse(it->X2,newWord,currentStack, depth+1,showStack);
105 itpop = ppit->first.begin();
106 for(itstack = currentStack.rbegin(); itstack != currentStack.rend(); itstack++){
109 if(*itstack != *itpop){
115 if(itpop == ppit->first.end()){
118 for(j = 0; j < ppit->first.size(); j++){
119 currentStack.pop_back();
123 currentStack.insert(currentStack.end(), ppit->second.rbegin(), ppit->second.rend());
126 std::string newWord = word;
130 Traverse(it->X2,newWord,currentStack, depth+1,showStack);