Seth.

Floyd-Warshall Algorithm

012351031

Resultant Distance Matrix

From / To0123
00510
103
201
30

Floyd-Warshall - Technical Overview

1. Algorithm Description: The Floyd-Warshall algorithm computes shortest paths between all pairs of vertices, handling both positive and negative edge weights.

2. Steps of the Floyd-Warshall Algorithm:

3. Time Complexity: O(V³) due to three nested loops over the vertices.

4. Space Complexity: O(V²) as a 2D matrix is required to store distances between all pairs.

5. Usage: Floyd-Warshall is used for finding shortest paths in dense graphs and can handle negative weights but not negative weight cycles.