Djikstras algorithm Flashcards
(3 cards)
1
Q
what is djikstras algorithm
A
finding the shortest path
2
Q
what are the rules for the algorithm
A
- every time we set out to visit a new node, we will choose the node with the smallest known distance to visit first
- once weve moved to the node were going to visit, we will check each of its neigbouring nodes
- for each neigbouring node, calculate the distance
- if the distance to a node is less than a known distance, update the shortest distance that we have on file for thast vertex
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