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     AA -> B : 7     A -> BA -> C : 9     A -> CA -> D : 20    A -> C -> DA -> E : 20    A -> C -> F -> EA -> F : 11    A -> C -> F

Get The Modern C++ Challenge now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.