Modeling with Graphs and Finite State Automata