Let's apply the algorithm

Report a typo

Given below is a weighted directed graph:

Let's apply the Dijkstra's algorithm

Find the shortest paths from the node AA to all other nodes of the graph using Dijkstra's algorithm. Print the shortest path tree and the shortest distances for each node to the field below. Below is the expected output format:

A B
B C
C D
0 2 3 5

In this example, the first three lines are the edges of the shortest path tree, the last line contains the shortest distances for the nodes: 00 for AA, 22 for BB and so on (the nodes are sorted in the alphabetical order).

Enter a short text
___

Create a free account to access the full topic