Reorganized and added a test

I reorganized the graph namespace and added a very simple test to make
sure cycle detection was working