File Exchange

image thumbnail

Floyd Shortest Path Routing

version (583 Bytes) by Weihuang Fu
find the shortest path from any node to any node in a network


Updated 27 Jun 2006

No License

Given a input adjacent matrix (AdjMax) that represents a weighted, directed graph. The function finds the shorest path from one vertex 'i' to another 'j'. The return values includes a matrix (S) that denotes the shortest distance between vertices 'i' and 'j', and a matrix (P) that denotes the next vertex 'k' on the path from vertex 'i' to vertex 'j'

Cite As

Weihuang Fu (2021). Floyd Shortest Path Routing (, MATLAB Central File Exchange. Retrieved .

Comments and Ratings (11)

Nur Tasleem Banu

maryam esfahani

it gives the wrong matrix p. it doesn t update at step 1 and P is just wrong for step 1. what can i do please helppppp :(((

Xidong WEI

Good job.It helps me a lot


yousaf zia

Great me to solve my problem....
i have to find the shortest path from source to destination by considering minimum loss of packets,delay ,bandwidth utilization and weight into account........just hint me what to do by GA..
have u known link related to my work.
thanking you

Benjamin Knight

Great code works perfectly for my problem which was a small matrix (47x47).

Benjamin Knight

Great code works perfectly for my problem which was a small matrix (47x47) and didn't have much node connection redundancy. I had lots of issues with the dijkstra algorithms which kept returning 'inf' results - although I suspect connection redundancy was the issue here.

Tom Shan

worked for me

J. Kimer

Hamid Smith

J. Magro

It might take hours or even days to compute the shortest path for a large adjacency matrix using this un-vectorized code. Too many loops!

MATLAB Release Compatibility
Created with R14SP1
Compatible with any release
Platform Compatibility
Windows macOS Linux

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!