Vectorized Floyd-Warshall
The Floyd-Warshall algorithm computes the all pairs shortest path matrix for a given adjacency matrix. The algorithm is O(n^3), and in most implementations you will see 3 nested for loops. This is very inefficient in Matlab, so in this version the two inner loops are vectorized (and as a result, it runs much faster).
Make sure that your input matrix is initialized properly -- A(i,j) = Inf if i and j are not neighbors.
Cite As
Dustin Arendt (2024). Vectorized Floyd-Warshall (https://www.mathworks.com/matlabcentral/fileexchange/25776-vectorized-floyd-warshall), MATLAB Central File Exchange. Retrieved .
MATLAB Release Compatibility
Platform Compatibility
Windows macOS LinuxCategories
Tags
Acknowledgements
Inspired: Floyd-Warshall (vectorized), primal network simplex
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!Discover Live Editor
Create scripts with code, output, and formatted text in a single executable document.
Version | Published | Release Notes | |
---|---|---|---|
1.0.0.0 |