The Floyd-Warshall Algorithm

  • Number the vertices of by .
  • Consider all paths from to whose intermediate vertices are all drawn from
  • Let be the one with minimum weight from the aforementioned paths
    • If , then all intermediate vertices of belong to
    • If , decompose into , the intermediate vertices of the two resulting paths are also in
  • The final result is given by