Given a weighted directed graph with **n** vertices (edge weights may be negative, but no negative cycles), compute the **shortest distance between every pair of vertices** using the **Floyd-Warshall algorithm**. Return the result as an n×n matrix, where unreachable pairs have distance `Infinity`.
Step-by-step visualizer available!
Switch to the Visualize ✨ tab to watch this algorithm run step-by-step on a live graph before you code.