Note: This page is a local copy of one written by Carla Laffra of Pace University, and has been installed with permission.
This page demonstrates the use of Java for educational purposes.It describes Dijkstra's well known algorithm to determine the shortest paths in a graph from a given startpoint to any other point. The Dijkstra shortest path algorithm is decribed in many text books, including the very thorough:
Interestingly enough, in that book, the algorithm is explained by showing a sample graph where its nodes are colored differently at each step in the algortithm. In that way the authors try to explain the execution of the algorithm, on such a limited medium as paper.
The following Java applet will make the explanation come alive through a user-controlled animation. Each step in the algorithm is explained with a short text shown in a special text area. The applet successfully proves the power of the use of Java for the interactive explanation of (more or less) complex algortithms.
The applet gives the following options:
Then, you can either
Here is the source code.