Fshl0

Floyd-Warshall Algorithm

Apr 6th, 2020
451
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. for (int k = 1; k <= n; k++)
  2.     for (int i = 1; i <= n; i++)
  3.          for (int j = 1; j <= n; j++)
  4.             if (dist[i][k] < inf && dist[k][j] < inf)
  5.                 dist[i][j] = min(dist[i][j], dist[i][k] + dist[k][j]);
RAW Paste Data