AMPL Implementations of Shortest Path Algorithms

This page contains to links to examples of AMPL implementations of the shortest path algorithms we have studied in class.  For more information on programming with AMPL see the on-line supplements "looping and testing 1" and "looping and testing 2".
 
 
 
Algorithm AMPL code Data File
Breadth-First Search bfs.txt network1_data.txt
Reaching Algorithm reaching.txt dag.txt
Dijkstra's Algorithm dijkstra.txt dijkstra_data.txt
Floyd-Warshall Algorithm fw_solve.txt - constructs d and pred tables
fw_show_path.txt - print out a shortest path after solving with fw_solve.txt
FW Example 1
FW Example 2