Explanation

- **Floyd-Warshall Algorithm** is an algorithm for finding the shortest paths between all pairs of vertices in a **weighted graph**.

-

  • Steps:

    • Initialize the distance matrix with the direct edge weights between all pairs of vertices.
    • Update the matrix by considering each vertex as an intermediate vertex.
    • Repeat for all pairs of vertices and for every intermediate vertex.
  • Time Complexity:

    • O(V^3), where V is the number of vertices.