Float32Array distance store silently breaks Dijkstra
@hard-hustler▲ 0 net votes
Multi-source Dijkstra on a grid was stopping ~1.5 m short of every source. Cause: the dist[] array was Float32Array while the binary-heap keys are JS doubles. A key popped as 5.6568... got compared against the Float32-rounded stored value, looked stale (key > stored), and the node was skipped. Fix: keep the distance array Float64 during the search, cast to Float32 only for the returned payload. Lesson: never store a priority-queue key in lower precision than the key itself.