### 基于dijkstra的低耗路由matlab仿真 评分:

Inputs: [AorV] Either A or V where A is a NxN adjacency matrix, where A(I,J) is nonzero if and only if an edge connects point I to point J NOTE: Works for both symmetric and asymmetric A V is a Nx2 (or Nx3) matrix of x,y,(z) coordinates [xyCorE] Either xy or C or E (or E3) where xy is a Nx2 (or Nx3) matrix of x,y,(z) coord inates (equivalent to V) NOTE: only valid with A as the first input C is a NxN cost (perhaps distance) matrix, where C(I,J) contains the value of the cost to move from point I to point J NOTE: only valid with A as the first input E is a Px2 matrix containing a list of edge connections NOTE: only valid with V as the first input E3 is a Px3 matrix containing a list of edge connections in the first two columns and edge weights in the third column NOTE: only valid with V as the first input [SID] (optional) 1xL vector of starting points. If unspecified, the algorithm will calculate the minimal path from all N points to the finish point(s) (automatically sets SID = 1:N) [FID] (optional) 1xM vector of finish points. If unspecified, the algorithm will calculate the minimal path from the starting point(s) to all N points (automatically sets FID = 1:N) Outputs: [costs] is an LxM matrix of minimum cost values for the minimal paths [paths] is an LxM cell containing the shortest path arrays [showWaitbar] (optional) a scalar logical that initializes a waitbar if nonzero Note: If the inputs are [A,xy] or [V,E], the cost is assumed to be (and is calculated as) the point to point Euclidean distance If the inputs are [A,C] or [V,E3], the cost is obtained from either the C matrix or from the edge weights in the 3rd column of E3 Example: % Calculate the (all pairs) shortest distances and paths using [A,C] inputs n = 7; A = zeros(n); xy = 10*rand(n,2) tri = delaunay(xy(:,1),xy(:,2)); I = tri(:); J = tri(:,[2 3 1]); J = J(:); IJ = I + n*(J-1); A(IJ) = 1 a = (1:n); b = a(ones(n,1),:); C = round(reshape(sqrt(sum((xy(b,:) - xy(b',:)).^2,2)),n,n)) [costs,paths] = dijkstra(A,C) Example: % Calculate the shortest distance and path from point 3 to 5 n = 15; A = zeros(n); xy = 10*rand(n,2) tri = delaunay(xy(:,1),xy(:,2)); I = tri(:); J = tri(:,[2 3 1]); J = J(:); IJ = I + n*(J-1); A(IJ) = 1 [cost,path] = dijkstra(A,xy,3,5) gplot(A,xy,'b.:'); hold on; plot(xy(path,1),xy(path,2),'ro-','LineWidth',2) for k = 1:n, text(xy(k,1),xy(k,2),[' ' num2str(k)],'Color','k'); end Example: % Calculate the shortest distances and paths from the 3rd point to all the rest n = 7; V = 10*rand(n,2) I = delaunay(V(:,1),V(:,2)); J = I(:,[2 3 1]); E = [I(:) J(:)] [costs,paths] = dijkstra(V,E,3) Example: % Calculate the shortest distance and path from points [1 3 4] to [2 3 5 7] n = 7; V = 10*rand(n,2) I = delaunay(V(:,1),V(:,2)); J = I(:,[2 3 1]); E = [I(:) J(:)] [costs,paths] = dijkstra(V,E,[1 3 4],[2 3 5 7]) Revision Notes: (3/13/15) Previously, this code ignored edges that have a cost of zero, potentially producing an incorrect result when such a condition exists. I have solved this issue by using NaNs in the table rather than a sparse matrix of zeros.
...展开详情收缩
2016-10-26 上传大小：4KB

### 评论共1条

qq_37500909 感谢分享！
2019-04-29

MATLAB实现洪泛路由的模拟

QoS组播路由蚁群算法 matlab 仿真实现源码

GPSR路由算法 立即下载
WSN的matlab仿真代码 立即下载

Q-Learing路径规划MATLAB仿真 立即下载
wsn分簇LEACH和DEEC算法之matlab仿真 立即下载
WSN无线传感器网络的分簇仿真Matlab代码大全 立即下载
dijkstra算法 立即下载
AODV MATLAB 实现 立即下载

Dijkstra 算法 进行 matlab仿真 立即下载

### 热点文章

• #### MATLAB实现洪泛路由的模拟

2019-05-15 zero_hero001
• #### 一个简易版支付路由实现

2014-06-06 MDL13412
• #### 静态路由实现负载均衡和高可用

2008-01-01 weixin_34235457

2015-07-06 kfjk2004
• #### QoS组播路由蚁群算法 matlab 仿真实现源码

2018-03-05 yuankkkkk
• #### MATLAB SPIN路由算法

2019-03-20 sinat_41932265
• #### Matlab R2017b快速入门

2018-01-06 u011054333
• #### leach路由协议的MATLAB代码

2012-04-18 guowei216
• #### 基于MATLAB的pegasis路由算法研究

2016-11-08 dsfsfsffddsfvv
• #### MATLAB中cumsum函数

2016-10-11 puyaangela

### spring mvc+mybatis+mysql+maven+bootstrap 整合实现增删查改简单实例.zip

 资源所需积分/C币 当前拥有积分 当前拥有C币 5 0 0

VIP下载

## 积分不足！

 资源所需积分/C币 当前拥有积分

 4000万 程序员的必选 600万 绿色安全资源 现在开通 立省522元

 资源所需积分/C币 当前拥有积分 当前拥有C币 5 4 45

 资源所需积分/C币 当前拥有积分 当前拥有C币 9 0 0

 资源所需积分/C币 当前拥有积分 当前拥有C币 5 4 45

• 举报人：
• 被举报人：
• *类型：
• *投诉人姓名：
• *投诉人联系方式：
• *版权证明：
• *详细原因：