matlab工具箱计算最小生成树_MATLAB图论通用工具箱

图论常用matlab算法最小生成树

包括的函数如下:

function [lWeight,ETree]=LeastTree(MTree,begX)

%LEASTTREE  Find the least spanning tree on Graph based on Prim Method

%  [lWeight,ETree,varargout]=LeastTree(MTree,begX,varargin)

%  See also LEASTPATH, LEASTTREEEX

%  Copyright 2008-9-3 Tan KaiShuai Corporation

根据加权邻接矩阵MTree求取最小生成树ETree,MTree的每一列确定一条

边(路径),lWeight返回求得的最小生成树的权和(即为最小路径)。在

MTree中如果两点间无相邻,可用无穷(inf)标识,也可用负数(如-1)代替。

begX用于确定算法的初始搜索点,可任意指定有效点的索引:1~length(MTree),

通常取1即可。

function [lWeight,ETree]=LeastTreeEx(MTree,begX,endX)

%LEASTTREEEX  Find the least path on Graph based on Kijkstra Method

%  [lWeight,ETree]=LeastTreeEx(MTree,begX,endX)

%  See also LEASTPATH, LEASTTREE

%  Copyright 2008-9-3 Tan KaiShuai Corporation

根据加权邻接矩阵MTree求取根在begX的有向最小生成树ETree,MTree的每一列

确定一条边(路径),在MTree中如果两点间无相邻,可用无穷(inf)标识,

也可用负数(如-1)代替。begX用于确定算法的初始搜索点(即树根位置),

endX指定所求树枝顶点位置。lWeight返回begX与endX之间的最短路径。

function [lWeight,ETree]=LeastTreePlus(MTree)

%LEASTTREEPLUS  Find the least spanning tree on Graph based on Kruskal Method

%  [lWeight,ETree,varargout]=LeastTreePlus(MTree,varargin)

%  See also LEASTPATH, LEASTPATHEX, LEASTTREEEX

%  Copyright 2008-9-10 Tan KaiShuai Corporation

与函数LeastTree(...)相同,但使用不同的算法实现。

根据加权邻接矩阵MTree求取最小生成树ETree,MTree的每一列确定一条

边(路径),lWeight返回求得的最小生成

你可能感兴趣的:(matlab工具箱计算最小生成树_MATLAB图论通用工具箱)