最短路径_Floyd算法_matlab实现.doc
function [D,R]=floyd(A) %用floyd算法实现求任意两点之间的最短路程可以有负权 %参数D为连通图的权矩阵 % A=[0 2 8 1 inf inf inf inf % 2 0 6 inf 1 inf inf inf % 8 6 0 7 5 1 2 inf % 1 inf 7 0 inf inf 9 inf % inf 1 5 inf 0 3 inf 8 % inf inf
function [D,R]=floyd(A) %用floyd算法实现求任意两点之间的最短路程可以有负权 %参数D为连通图的权矩阵 % A=[0 2 8 1 inf inf inf inf % 2 0 6 inf 1 inf inf inf % 8 6 0 7 5 1 2 inf % 1 inf 7 0 inf inf 9 inf % inf 1 5 inf 0 3 inf 8 % inf inf