Given below is a weighted directed graph:
Find the shortest paths from the node 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: for , for and so on (the nodes are sorted in the alphabetical order).