Decision 1 Unit 4 Flashcards
How are the boxes for Dijkstra’s Algorithm presented?
|____|____|.
|________|.
The first box is for the order that it is labelled. The second is the permanent amount that it is labelled as. The bottom is the working values from the start which change.
What is Dijkstra’s Algorithm used for?
To find the shortest route from one node to another.
How to use Dijkstra’s Algorithm?
- Label the staring node (S) 1 and a permanent value of 0.
- Give each node connected to S a working value which is its distance from S.
- Find the smallest working value and use this as a permanent value for that node and label it 2.
- Repeat by finding any new or smaller working values and selecting the smallest etc until a route is found.
How to find the shortest route from the permanent labels?
Starting at the end node, take away the permanent label of a connecting node from the end node’s. If the amount is the same as the arc then it could have came this way. Repeat until back to start.
Remember to check for more than one route.
What is the order of Dijkstra’s algorithm?
n^2