Remove "require 'rubygems'" statements.

It's considered a bad practice to require 'rubygems' inside a gem.
Original post: http://tomayko.com/writings/require-rubygems-antipattern
Refactor GraphVisitor.

* Make def_event_handler available wherever GraphVisitor is included.
* Extract distance map support into a module.
Add Dijkstra algorithm (NOT FINISHED).