keymasterviriya1150

Floyd-Warshall Code

Apr 18th, 2016
157
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.23 KB | None | 0 0
  1. for (int m = 0; m < V; m++) // Transit
  2. {
  3.     for (int i = 0; i < V; i++) // Source
  4.     {
  5.         for (int k = 0; k < V; k++) // Destination
  6.         {
  7.             if (dist[i][m] + dist[m][k] < dist[i][k])
  8.                 dist[i][k] = dist[i][m] + dist[m][k];
  9.         }
  10.     }
  11. }
Advertisement
Add Comment
Please, Sign In to add comment