A Ruby implementation to understand the Dijkstra algorithm.
Dijkstra is an algorithm for finding the shortest paths between nodes in a graph.
- Written in Ruby
- Written for Readability
- Written in an Object Oriented style
- Loosely Tested with RSpec (more specs in another project)
Tested using the Kiwiland Railway exercise (Kaitaia / Invercargill). Can be used to solve:
- The length of the shortest route (in terms of distance to travel) from A to C.
- The length of the shortest route (in terms of distance to travel) from B to B.
See my solution here for the complete exercise.
- Ruby 2.3.1
- Bundler Gem
bundle
bundle exec rspec dijkstra.rb --color --format d