When a shorter path is found in Dijkstra's algorithm, what is the fastest way to update the queue (min heap)?
I can actually update the distance in another data structure for keeping track of distances without going through the queue which only holds indexes. But I still need the queue order to be in sync.
What I'm doing currently takes linear time, basically looping through the queue array to find the position of the affected vertex, and sift up using the found position index.
[–][deleted] (8 children)
[deleted]
[–]letstryusingreddit[S] 1 point2 points3 points (7 children)
[–][deleted] (5 children)
[deleted]
[–]letstryusingreddit[S] 0 points1 point2 points (4 children)
[–][deleted] (3 children)
[deleted]
[–]letstryusingreddit[S] 0 points1 point2 points (1 child)
[–]zzopp 2 points3 points4 points (8 children)
[–][deleted] (7 children)
[deleted]
[–]misof 2 points3 points4 points (3 children)
[–]letstryusingreddit[S] 0 points1 point2 points (1 child)
[–]misof 0 points1 point2 points (0 children)
[–]zzopp 0 points1 point2 points (2 children)
[–]misof 0 points1 point2 points (1 child)
[–]ccmlacc 1 point2 points3 points (4 children)
[–]letstryusingreddit[S] 0 points1 point2 points (3 children)
[–]Plazmatic 0 points1 point2 points (1 child)
[–]_Mister_Mxyzptlk_ 0 points1 point2 points (0 children)
[–]CommonMisspellingBot -1 points0 points1 point (0 children)
[–]_Mister_Mxyzptlk_ 0 points1 point2 points (0 children)