commented and refactored graph.rb

The file was kind of confusing and had bad method names and it was
full of ninja comments. So... I've added comments as well as
cleaned up the method names. This also means that I broke some tests
so I had to fix that and what not, but we're all good now.