Build matrices quickly, test directed graphs, and verify costs. Review intermediate updates and decisions clearly. Solve complex routing problems with stepwise shortest path outputs.
Enter a weighted adjacency matrix. Use numbers for edge costs and INF for missing edges.
This sample graph demonstrates directed weighted edges and missing links.
| From | To | Weight |
|---|---|---|
| A | B | 3 |
| A | D | 7 |
| B | A | 8 |
| B | C | 2 |
| C | A | 5 |
| C | D | 1 |
| D | A | 2 |
The Floyd Warshall method improves every pair distance by testing each node as an intermediate stop. It starts with the original adjacency matrix and repeatedly updates distances whenever a shorter route appears through node k.
Path reconstruction uses a next-hop matrix. When distance i→j improves through k, the first step becomes the first step of i→k. Negative cycles are flagged whenever any final diagonal distance becomes negative.
It computes shortest distances between every ordered pair of nodes. It also shows a next-hop matrix, a selected route, graph metrics, and optional intermediate iterations.
Yes. Floyd Warshall supports negative edges as long as the graph does not contain a reachable negative cycle that makes shortest paths undefined.
Use INF for any missing direct edge. The calculator treats that cell as unreachable until another indirect route produces a finite path.
Each cell shows the first node to visit when traveling from one source node to a destination along a shortest path. It helps reconstruct routes quickly.
The diagonal usually starts at zero because every node reaches itself with no cost. A negative final diagonal value signals a negative cycle.
The calculator mirrors each edge weight across the diagonal. If opposite directions differ, it keeps the smaller finite value for both directions.
No route appears when the destination remains unreachable from the chosen source. In that case, the final distance stays INF and the path is empty.
Enable them when learning the method, debugging a matrix, or verifying how each intermediate node improves distances during the dynamic programming process.
Important Note: All the Calculators listed in this site are for educational purpose only and we do not guarentee the accuracy of results. Please do consult with other sources as well.