Optimisation Algorithms Flashcards

1
Q

Dijkstras Shortest Path algorithm

A

Find the shortest path between a starting node and every other node in a WEIGHTED graph

Supporting data structure - priority queue

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

What happens when the priority queue is not empty?

A

Remove the node at the front of the queue

This node is referred to as the current node.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

What is done with each neighbour of the current node?

A

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.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

What condition must be met to replace a neighbour’s distance?

A

If the new distance is less than the neighbour’s current distance

This ensures that only shorter paths are considered.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

Fill in the blank: The current node is removed from the priority queue and is referred to as the _______.

A

[current node]

How well did you know this?
1
Not at all
2
3
4
5
Perfectly