How to Use Dijkstra's Algorithm
Construct your network (or graph).,Label the starting node with a 0 and put a box/circle around it., Look at each of the arcs connecting to the starting node and choose the one of least value.,Temporarily label (numbers without boxes) all nodes...
Step-by-Step Guide
-
Step 1: Construct your network (or graph).
If this is homework you will already have your network but if you are using this for practical purposes you will need to construct your network to show all possible routes and route crossovers.
Try to include as many options as you can. ,, Write the value next to the node it is connecting to and draw a box around it.,,,, You've found the path of least weight! -
Step 2: Label the starting node with a 0 and put a box/circle around it.
-
Step 3: Look at each of the arcs connecting to the starting node and choose the one of least value.
-
Step 4: Temporarily label (numbers without boxes) all nodes connecting to the permanent labelled (boxed) nodes with their distance from the starting point.
-
Step 5: Choose the temporary label of least value and box it.
-
Step 6: Repeat steps 4 & 5 until the node you are trying to reach (the destination node) has a permanent label.
-
Step 7: Retrace the shortest route backwards through the network back to your start node.
Detailed Guide
If this is homework you will already have your network but if you are using this for practical purposes you will need to construct your network to show all possible routes and route crossovers.
Try to include as many options as you can. ,, Write the value next to the node it is connecting to and draw a box around it.,,,, You've found the path of least weight!
About the Author
Patricia Murray
Creates helpful guides on cooking to inspire and educate readers.
Rate This Guide
How helpful was this guide? Click to rate: