Optimisation Algorithms Flashcards
Dijkstras Shortest Path algorithm
Find the shortest path between a starting node and every other node in a WEIGHTED graph
Supporting data structure - priority queue
What happens when the priority queue is not empty?
Remove the node at the front of the queue
This node is referred to as the current node.
What is done with each neighbour of the current node?
Compute new distance by adding together the temporary distance at the current node and the length of the edge going to that neighbour
This calculation helps to determine if a shorter path exists.
What condition must be met to replace a neighbour’s distance?
If the new distance is less than the neighbour’s current distance
This ensures that only shorter paths are considered.
Fill in the blank: The current node is removed from the priority queue and is referred to as the _______.
[current node]