next up previous contents
Next: Minimizing Acyclic DFAs Up: Getting Started Previous: Constructing an Automaton   Contents

Accessing States Transitions

#include <astl.h>
#include <dfa.h>
#include <iostream>

int main()
{
  using namespace std;
  typedef DFA_matrix<> DFA;
  DFA A;
  // Construction...
  DFA::state_type q = A.initial();
  DFA::state_type p = A.delta1(q, 'a');
  if (p == A.null_state) cout << "undefined" << endl;
  DFA::edges_type e = A.delta2(q);
  if (e.find('b') == e.end()) cout << "undefined" << endl;
  DFA::edges_type::const_iterator i;
  for(i = e.begin(); i != e.end(); ++i)
    cout << " source " << q 
         << " letter " << i->first 
         << " aim "    << i->second;
}


Vincent Le Maout 2003-07-08