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...

7 Steps 1 min read Medium

Step-by-Step Guide

  1. 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!
  2. Step 2: Label the starting node with a 0 and put a box/circle around it.

  3. Step 3: Look at each of the arcs connecting to the starting node and choose the one of least value.

  4. Step 4: Temporarily label (numbers without boxes) all nodes connecting to the permanent labelled (boxed) nodes with their distance from the starting point.

  5. Step 5: Choose the temporary label of least value and box it.

  6. Step 6: Repeat steps 4 & 5 until the node you are trying to reach (the destination node) has a permanent label.

  7. 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

P

Patricia Murray

Creates helpful guides on cooking to inspire and educate readers.

106 articles
View all articles

Rate This Guide

--
Loading...
5
0
4
0
3
0
2
0
1
0

How helpful was this guide? Click to rate: