This Dijkstra algoritm in rails application