Matlab图论工具箱的命令见表1
表1 matlab图论工具箱的相关命令
命令名
功能
graphallshortestpaths
求图中所有顶点对之间的最短距离
graphconncomp
找无向图的连通分支,或有向图的强弱连通分支
graphisdag
测试有向图是否含有圈,不含圈返回1,否则返回0
graphisomorphism
确定两个图是否同构,同构返回1,否则返回0
graphisspantree
确定一个图是否是生成树,是返回1,否则返回0
graphmaxflow
计算有向图的最大流
graphminspantree
在图中找最小生成树
graphpred2path
把前驱顶点序列变成路径的顶点序列
graphshortestpath
求图中指定的一对顶点间的最短距离和最短路径
graphtopootder
执行有向无圈图的拓扑排序
graphtraverse
求从一顶点出发,所能遍历图中的顶点
1.图的最短路径graphallshortestpaths函数的命令格式:
[dist]=graphallshortestpaths(G)
[dist]=graphallshortestpaths(G,...’Directed’,DirectedValue,...)
[dist]=graphallshortestpaths(G,...’Weights’,WeightsValue,...)
G是代表一个图的N