added small graph library

NFAs and DFAs are both basically directed, weighted (the weights are
more like labels) graphs, and I've been wondering if using an explicit
graph datatype would make the code clearer.

Converting an NFA to a DFA is actually a graph search of the DFA under
construction, but I'm not sure how easy that would be to express with
this graph library.