Submitted by: Submitted by osamayawar
Views: 83
Words: 1601
Pages: 7
Category: Business and Industry
Date Submitted: 01/28/2014 07:07 AM
Project Documentation
SHORTEST PATH ALGORITHM (Dijkstra)
PSEUDOCODE:
function Dijkstra(Graph, source):
for each vertex v in Graph:
dist[v] := infinity ;
previous[v] := undefined ;
end for
dist[source] := 0 ;
Q := the set of all nodes in Graph ;
while Q is not empty:
u := vertex in Q with smallest distance in dist[] ;
remove u from Q ;
if dist[u] = infinity:
break ;
end if
for each neighbor v of u:
alt := dist[u] + dist_between(u, v) ;
if alt < dist[v]:
dist[v] := alt ;
previous[v] := u ;
decrease-key v in Q;
end if
end for
end while
return dist;
endfunction
Source: http://en.wikipedia.org/wiki/Dijkstra%27s_algorithm
INSTRUCTIONS:
The program has been implemented in two different languages i.e. Python and PHP and use one input file and output file. After the execution of program, it asks the user to enter the input file name and output file name. Following are the details instructions in each language.
Note: The instructions given below are for Macintosh OS. It may differ from Windows OS.
PYTHON:
Compilation and Execution:
* Open Python IDLE (Shell) and click on “File”.
* Click “Open”...