Dijkstra's algorithm: Difference between revisions
→{{header|ATS}}
Line 1,062:
val active = arrayref_make_elt<bool> (n, true)
fun
Line 1,077 ⟶ 1,076:
fun
main_loop (pq
:<!refwrt,!ntm> void =
if
let
val @(priority, u) =
Line 1,087 ⟶ 1,085:
(* Ignore any queue entries that might raise the cost. *)
if priority > cost[u] then
main_loop
else
let
val () = active[u] := false
fun
Line 1,126 ⟶ 1,123:
end;
main_loop
end
val () = fill_pq (pq, i2sz 0)
val () = main_loop
in
@(cost, prev)
|