
The graph
module has a few “single-source shortest paths” functions, but I was unable to find a function to return just the shortest weighted path between a source and destination as opposed to computing all the shortest paths from the source to every other vertex. Did I miss something?

I didn’t see it either, and copying the original dijkstra code + adding the correct #:break:
to it didn’t seem to impact perf for me very much on part1, so I didn’t even test it for part2 (see thread for timing/link)

In terms of the shortest-path algorithms, they just return the parent of each node in the shortest-path tree. That’s what any algorithm has to compute.

But given the current implementation in graph
, I’m not sure if dijkstra
correctly avoids duplicated node visits. The implementation a bit too abstract for me.

Is it clear, that one can compute a shortest path without computing paths to the other nodes?