Require rubygems in test_helper (for MRI 1.8.7).
Refactor GraphVisitor.

* Make def_event_handler available wherever GraphVisitor is included.
* Accept symbols in def_event_handler.
* Extract distance map support into a module.
Remove JRuby from Travis CI build.

JRuby support is tricky, because of the dependency on 'algorithms'
gem that includes C extensions and the fact that building native
extensions for JRuby is not recommended and most likely will become
impossible in the future.
Add Dijkstra algorithm.