Given a undirected graph with weights, return the sum of the weight of each path between two nodes (no negative edges).
Input:
Solution:Using Floyd-Warshall algorithm get the 2 dimensional array of path costs: A B C D A 0 1 3 4B 1 0 2 3C 3 2 0 5D 4 3 5 0The sum of top right triangle (shown in bold) is the answer. |

Trees and Graphs >