Added a bunch of unit tests, and fixed a bunch of bugs with basic graph algorithms in loopy environments.