Implement a graph.

Lots more to come. The foundation is laid here.