Understanding Floyd Warshall Matrices
The Floyd Warshall method finds shortest paths between every pair of vertices. It works with directed graphs and weighted matrices. It can also work with undirected graphs when opposite edges are mirrored. The calculator treats INF as no direct route. A zero diagonal means every node reaches itself with no cost.
Why This Calculator Helps
Manual matrix updates are slow. Each intermediate vertex can change many routes. This page compares every route through every possible middle node. It then shows the final distance matrix, next-hop matrix, route summary, and warning messages. It also highlights negative cycles when they appear. A negative cycle can make a shortest path undefined, because the route cost can keep falling.
Input Quality Matters
Use one row for each vertex. Keep the same number of values in every row. Enter numbers for edge costs. Use INF, X, or ∞ for missing edges. Negative weights are allowed. They are useful in many algebraic graph examples. Avoid negative cycles when you need stable shortest paths.
Reading The Results
The final matrix gives the best known cost from each source to each target. INF means the target is unreachable. The next-hop matrix tells which vertex should be visited first. The selected path box expands one route into a readable sequence. The heatmap makes low and high costs easier to compare.
Practical Uses
This method is useful in network routing, logistics, operations research, game maps, and dependency analysis. It is best for dense graphs or small teaching examples. For very large sparse graphs, repeated Dijkstra searches may be faster. Floyd Warshall is still valuable because it is simple, complete, and easy to audit.
Export And Review
CSV export is helpful for spreadsheets. PDF export is useful for reports, homework, and records. Save the results after checking the input units. Review the formula section when explaining your work. Compare the example table with your own matrix before using critical results.
Helpful Checks
Confirm row count before solving. Match labels to columns. Use the same unit for every edge. A route cost means nothing when minutes, miles, and fees are mixed without conversion. This prevents confusing final decisions later.