Jump to content

Dijkstra's algorithm: Difference between revisions

→‎{{header|Tailspin}}: Update to stricter typing
(→‎{{header|Tailspin}}: Update to stricter typing)
(→‎{{header|Tailspin}}: Update to stricter typing)
Line 5,615:
templates shortestPaths&{graph:}
@: {||};
{| {to: $, distance: 0"1", path:[]} |} -> #
when <?($::count <=0>)> do $@ !
otherwise
Line 5,628:
 
def edges: {|
{ from: 'a', to: 'b', cost: 7"1" },
{ from: 'a', to: 'c', cost: 9"1" },
{ from: 'a', to: 'f', cost: 14"1" },
{ from: 'b', to: 'c', cost: 10"1" },
{ from: 'b', to: 'd', cost: 15"1" },
{ from: 'c', to: 'd', cost: 11"1" },
{ from: 'c', to: 'f', cost: 2"1" },
{ from: 'd', to: 'e', cost: 6"1" },
{ from: 'e', to: 'f', cost: 9"1" }
|};
 
Anonymous user
Cookies help us deliver our services. By using our services, you agree to our use of cookies.