path: introduce an optimisation for function DijkstraFrom (proposal) (#196)
path: introduce an optimisation for function DijkstraFrom (proposal) (#196)

path: introduce an optimisation for function DijkstraFrom

If the distance is greater than the value stored in this distance node, then there already exist a better path to reach this node k. Indeed, the priority queue might contain several distanceNode for the same node k (each time it is updated), because this version of the dijkstra algorithm does not use a decrease-key operation. Therefore, these distanceNodes should be discarded. Otherwise, the adjacent vertices of k could be traversed more than once in the for loop.

gonum/gonum,gonum/gonum,gonum/gonum