I need to modify Dijkstra\'s algorithm so that if there are several shortest paths I need to find the one with minimum number of edges on the path.
I\'ve been stuck
Another option would be to add some small number ε
to the weight of every edge, where ε << edgeWeights
(for integer edge-weights you can choose ε < gcd(edgeWeights)/numberOfEdges
)
The advantage of this approach is that you don't need to write your own pathfinder, you can just use any off-the-shelf implementation.