Djikstras algorithm Flashcards

(3 cards)

1
Q

what is djikstras algorithm

A

finding the shortest path

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

what are the rules for the algorithm

A
  1. every time we set out to visit a new node, we will choose the node with the smallest known distance to visit first
  2. once weve moved to the node were going to visit, we will check each of its neigbouring nodes
  3. for each neigbouring node, calculate the distance
  4. if the distance to a node is less than a known distance, update the shortest distance that we have on file for thast vertex
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

explain the circumstances in which it would be more appriate to use an adjacency list instead of an adjamcency matrix

A
  • graph is sparse
  • when edges rearely change
How well did you know this?
1
Not at all
2
3
4
5
Perfectly