السلام عليكــم ورحمـة الله وبركاتــه
لدى صعوبة فى تحويل هذا الالجوريزم الى كود باستخدام الفيجول بيزك
اليكم الالجوريزم....فهل من مساعد؟
(* Dijkstra's Algorithm *)
let val q: queue = new_queue()
val visited: vertexMap = create_vertexMap()
fun expand(v: vertex) =
let val neighbors: vertex list = Graph.outgoing(v)
val dist: int = valOf(get(visited, v))
fun handle_edge(v': vertex, weight: int) =
case get(visited, v') of
SOME(d') =>
if dist+weight < d'
then ( add(visited, v', dist+weight);
incr_priority(q, v', dist+weight) )
else ()
| NONE => ( add(visited, v', dist+weight);
push(q, v', dist+weight) )
in
app handle_edge neighbors
end
in
add(visited, v0, 0);
expand(v0);
while (not (empty_queue(q)) do expand(pop(q))
end