badkins
2021-12-15 15:31:40

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?


ben.knoble
2021-12-15 16:40:49

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)


shu--hung
2021-12-15 23:24:58

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.


shu--hung
2021-12-15 23:30:45

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.


soegaard2
2021-12-16 07:29:31

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