This one is straightforward Djikstras algorithm .
Being annoyed of having to manually find the minimum element I had a little extra fun implementing a Heap in JavaScript.
Suppose there would be some room improving it - but I’m happy already.
The visualization for part 2 gets laggy on and is too large for the screen. I had it update a range of candidates simultanously - but in general it just updates only once or twice for the huge sample array - and is finished after a minute or so.
Input
Result
part 1: NaN
part 2: NaN