So this question might sound dumb and obvious but for some reason, I feel like there's more to just saving the current visited node to a prev list, (like explained on Dijkstra's Wikipedia page) before marking the neighbor with the shortest tentative distance the next current node. Can someone please explain how exactly Dijkstra's algorithm reconstructs the shortest path? ty in advance
0
votes
When going backward from the destination, you can always easily reconstruct which node comes next because difference in distance has to match the edge between them. If there are multiple nodes that fulfill this condition, there are multiple shortest paths.
- paleonix
through reverse recursion.
- D. Sikilai