This tool will help viewers visualize the Dijkstra Algorithm
What is Dijkstra's Algorithm?
Dijkstra's algorithm, also known as the shortest path algorithm, was created by Dr. Edsger W. Dijkstra. He made the algorithm in 1956 while having coffee with his fiancé in Amsterdam. He also claimed that the algorithm took him twenty minutes to develop.
The primary purpose of this algorithm is to find the shortest path between two nodes in a graph. A graph is a collection of nodes that may be directly or indirectly referenced together. Some typical data structures are specialized types of graphs. For example, linked lists and binary trees are just graphs that follow a specific format.
How it Works:
- Declare the starting node (green square) and an end node (red square).
- Create a structure to keep track of the distance between the source node and adjacent nodes.
- Set start node distance to zero, all other nodes to infinity.
- Grab the nodes closest to the source node, mark as visited.
- Continue until the closest node equals the finish node.
- Reverse the path from the finish node back to the source node.
Instructions:
- Click on the grid squares to create barriers.
- Click "Run Dijkstra Algo" Button.