Research Article

SPOT: A DSL for Extending Fortran Programs with Metaprogramming

Algorithm 9

The core code snippet of Dijkstra’s algorithm.
(1) subroutine dijkstra_distance (nv,ohd,mind)
(2)   !some other code
(3) connected(1) =.true.
(4) connected(2:nv) =.false.
(5) mind(1:nv) = ohd(1,1:nv)
(6) do step = 2, nv
(7) call find_nearest (nv,mind,connected,md mv)
(8) if(mv/=1) then
(9) connected(mv) =.true.
(10) end if
(11) if(mv/=1) then
(12) call update_mind (nv,connected,ohd,mv,mind)
(13) end if
(14) end do
(15) end