图论--Matlab实现最短路径算法

       使用Matlab的graphshortestpath 函数,快速求得最短路径,详情请参照Matlab帮助文档。

graphshortestpath solves the shortest path problem in graph.

 

  [DIST,PATH,PRED] = graphshortestpath(G,S) determines the single source

  shortest paths from node S to all other nodes in the graph G. Weights of

  the edges are all nonzero entries in the n-by-n adjacency matrix

  represented by the sparse matrix G. DIST are the n distances from source

  to every node (using Inf for non-reachable nodes and zero for the source

  node). The PATH contains the winning paths to every node, and PRED

  contains the predecessor nodes of the winning paths.

 

  [DIST,PATH,PRED] = graphshortestpath(G,S,D) determines the single

  source-single destination shortest path from node S to node D.

 

  graphshortestpath(...,'METHOD',METHOD) selects the algorithm to use,

  options are:

     'BFS'          - Breadth First Search, assumes all the weights are

                      equal, edges are nonzero entries in the sparse matrix

上一篇: 编写好的代码的10条戒律
下一篇: 基于MFC的Hough直线检测
_Cogito_
博客等级 码龄14年 35粉丝 8原创
评论 2
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

当前余额3.43元 前往充值 >
需支付:10.00元
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付元
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值
⌂ 换网址