FloydWarshall
Floyd-Warshall is an algorithm for finding shortest paths between all pairs of vertices in a weighted graph. It handles directed and undirected graphs and allows for negative edge weights, provided the graph does not contain any negative weight cycles.
The algorithm uses dynamic programming to iteratively improve estimates of the shortest path distances. It maintains
In addition to distances, the algorithm can maintain a predecessor or next matrix to reconstruct actual paths
The typical implementation runs in O(n^3) time and uses O(n^2) space, making it well-suited for dense graphs