Graphs (Undirected with Weights) Flashcards

1
Q

What does Dijkstra’s algorithm do?

A

It finds the shortest path. Uses a priority queue.
It doesn’t touch every node. Just uses pathfinding to find whatever path is cheapest.

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

What is Dijkstra’s algorithm an example of?

A

It is an example of a greedy algorithm because it always tries to use the next cheapest cost.

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

What happens when a node is visited in Dijkstra’s algorithm?

A

When a node is visited, it is put in the queue. It adds the total cost on how to get to it. If a total cost which is cheaper is found later, the initial node value will be replaced with the cheaper node value.

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

What is the goal of Dijkstra’s algorithm?

A

It prioritizes the cheapest way to get to the goal destination. The cheapest way depends on the parent. As we discover a cheaper way, we throw out an older way so by the time we get to the destination, that is the final cheapest way to get there.

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