[prev] 167 [next]

Floyd's Algorithm (cont)

Cost analysis …
  • initialising dist[][], path[][]   ⇒ O(V2)
  • V iterations to update dist[][], path[][]   ⇒ O(V3)
Time complexity of Floyd's algorithm: O(V3)    (same as Warshall's algorithm for transitive closure)