58. The shortest path between nodes

Write a program that, given a network of nodes and the distances between them, computes and displays the shortest distance from a specified node to all the others, as well as the path between the start and end node. As input, consider the following undirected graph:

The program output for this graph should be the following:

A -> A : 0     A
A -> B : 7 A -> B
A -> C : 9 A -> C
A -> D : 20 A -> C -> D
A -> E : 20 A -> C -> F -> E
A -> F : 11 A -> C -> F
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset