next up previous
Next: Warning Up: Basic Algorithms Previous: Warning

Iteration on $\Delta$

Remember $\Delta$ is the set of the transitions : $\Delta \subset Q \times \Sigma \times Q$. Some algorithms require to access sequentially the set of all transitions. You will find in the file dfa_iterator.hh the class trans_iterator implementing a forward iterator on $\Delta$ whose value type is a triple $\in Q \times \Sigma \times Q$. Here is how to print $\Delta$ on standard output:
#include "dfa_matrix.hh"
#include "dfa_iterator.hh"
#include "tag.hh"
#include "alphabet.hh"
#include <iostream.h>

  typedef DFA_matrix<Range_alphabet<char, 'a', 'z'>, STag> DFA_type;
  DFA_type dfa;
  // Construct the automaton
  // .....

  // Then declare a transition iterator on dfa
  trans_iterator<DFA_type> trans(dfa), trans_end(dfa);

  trans_end = dfa.end();
  for (trans = dfa.begin(); trans != trans_end; ++trans)
    triple<DFA_type::State, DFA_type::Alphabet, DFA_type::State> t = *trans;
    cout << t.first << " " << t.second << " " << t.third << endl;


Vincent Lemaout