topic badge

13.03 Dijkstra's algorithm for shortest paths

Interactive practice questions

In the following graph, we want to find the paths of lowest weight between the vertex $A$A and each of the other vertices. To do this, we will use Dijkstra's algorithm.

a

Perform the first step of the algorithm at the first working vertex, $A$A, by filling in the labels of all its adjacent vertices.

   
$1$1  
$0$0
   
   
$\editable{}$  
$\editable{}$
$\editable{}$  
$\editable{}$
   
   
$\editable{}$  
$\editable{}$
   
b

Perform the second step of the algorithm by choosing the next working vertex.

Vertex $A$A

A

Vertex $B$B

B

Vertex $C$C

C

Vertex $D$D

D
c

Perform the first step of the algorithm again at the new working vertex by updating the labels of all its adjacent vertices, where appropriate.

To update a label add a comma after the current label number, then write the new label number to form a list.

   
$1$1  
$0$0
   
   
$\editable{}$  
$9$9
$2$2  
$3$3
   
   
$\editable{}$  
$8$8
   
d

Perform the second step of the algorithm again by choosing the next working vertex.

Vertex $A$A

A

Vertex $B$B

B

Vertex $C$C

C

Vertex $D$D

D
e

Perform the first step of the algorithm again at the new working vertex by updating the labels of all its adjacent vertices, where appropriate.

To update a label add a comma after the current label number, then write the new label number to form a list.

   
$1$1  
$0$0
   
   
$4$4  
$9,8$9,8
$2$2  
$3$3
   
   
$3$3  
$8,5$8,5
   
f

For each vertex, enter the least weight between itself and vertex $A$A.

    $0$0    
   
$\editable{}$ $\editable{}$
   
    $\editable{}$    
Medium
3min

In the following graph, we want to find the paths of lowest weight between the vertex $A$A and each of the other vertices. To do this, we will use Dijkstra's algorithm.

Medium
2min

In the following directed graph, we want to find the paths of lowest weight which start at vertex $A$A and end at each of the other vertices. To do this, we will use Dijkstra's algorithm.

Medium
3min

Danielle has used Dijkstra's algorithm to help her find the paths of lowest weight between one of the vertices and each of the other vertices in the graph shown below.

By using the algorithm, Danielle has written down a list of labels next to each vertex.

Medium
1min
Sign up to access Practice Questions
Get full access to our content with a Mathspace account

Outcomes

ACMEM084

optimise distances through trial-and-error and systematic methods; for example, shortest path, routes to visit all towns, and routes to use all roads

What is Mathspace

About Mathspace