Dijkstra’s algorithm Flashcards

1
Q

What is Dijkstra’s algorithm?

A

It’s a graph algorithm that find the fastest solution

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

How does Dijkstra’s algorithm works?

A

Dijkstra’s algorithm:
1. Find the “cheapest” node. This is the node you can get to in the least amount of time.
2. Update the costs of the neighbors of this node.
3. Repeat until you’ve done this for every node in the graph.
4. Calculate the final path.

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

What is weight in Dijkstra’s algorithm?

A

It’s the number that associated with the edge
A graph with weights is called a weighted graph. A graph without weights is called an unweighted graph.

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

How to calculate path in graphs?

A

To calculate the shortest path in an unweighted graph, use breadth-first search. To calculate the shortest path in a weighted graph, use Dijkstra’s algorithm.

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

Can we use negative weight edges with Dijkstra’s algorithm?

A

No

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