"All Pairs Shortest Path" Graph Solver

版本 1.0.0.0 (1.3 KB) 作者: Michael Kleder
Gives the shortest node-to-node distance along the edges of a graph for all node combinations.
9.3K 次下载
更新时间 2007/12/26

无许可证

ALLSPATH - solve the All Pairs Shortest Path problem

Rapidly returns the shortest node-to-node distance along the edges of a graph, for all nodes in the graph.

USAGE: B = allspath(A)

A = input distance matrix between nodes

B = shortest path distance matrix between all nodes

Notes:
(1) For a graph with n nodes, A is an n-by-n distance matrix giving the distances between adjacent nodes. Since the distance from point i to point j is the same as the distance from point j to point i, A must be a symmetric matrix
(2) The distance from a node to itself can either be entered as zero or infinity. (Either will produce a correct result.) This means that the diagonal elements of the matrix A must all be either zero or infinity.
(3) The distance between nodes that are not adjacent to each other must be entered as either zero or infinity. (Either will produce a correct result.) This means that the (i,j) and (j,i) elements of A, where i and j are non-adjacent nodes, must all be either zero or infinity.
(4) If the input graph is not "connected," meaning that some nodes cannot be reached from other nodes no matter how many edges are traversed, then the distances between nodes that cannot be connected will be returned as infinite.
(5) Distances between a node and itself are returned as zero.
(6) This function codifies an original algorithm created by the author.
(7) No warranties; use at your own risk.
(8) Written by Michael Kleder, October 2005.

引用格式

Michael Kleder (2024). "All Pairs Shortest Path" Graph Solver (https://www.mathworks.com/matlabcentral/fileexchange/8808-all-pairs-shortest-path-graph-solver), MATLAB Central File Exchange. 检索时间: .

MATLAB 版本兼容性
创建方式 R14SP2
兼容任何版本
平台兼容性
Windows macOS Linux
类别
Help CenterMATLAB Answers 中查找有关 Construction 的更多信息

Community Treasure Hunt

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

Start Hunting!
版本 已发布 发行说明
1.0.0.0

Fixed a bug in the example. (An index variable had been omitted. Thanks to Joseph Kirk for pointing out the bug.)