Dijkstra's algorithm: Difference between revisions

Content added Content deleted
(→‎{{header|Forth}}: Handle case when not all nodes are reachable.)
(→‎{{header|Forth}}: correct data to match what's provided in the description)
Line 3,495: Line 3,495:
'a , 'c , 9 , edge-count 1+!
'a , 'c , 9 , edge-count 1+!
'a , 'f , 14 , edge-count 1+!
'a , 'f , 14 , edge-count 1+!
'b , 'c , 10 , edge-count 1+!
'b , 'd , 15 , edge-count 1+!
'b , 'd , 15 , edge-count 1+!
'c , 'd , 11 , edge-count 1+!
'c , 'd , 11 , edge-count 1+!
Line 3,654: Line 3,655:
Shortest path to each vertex from b:
Shortest path to each vertex from b:
a: ∞ (unreachable)
a: ∞ (unreachable)
c: (unreachable)
c: 10 (c←b)
f: 30 (f←e←d←b)
f: 12 (f←c←b)
d: 15 (d←b)
d: 15 (d←b)
e: 21 (e←d←b)
e: 21 (e←d←b)