dijkstra(Graph, Source, Destination, restrict2Nodes)

バージョン 1.0.0.0 (4.58 KB) 作成者: Pramit Biswas
Dijkstra's Algo to find shortest path, with ability to restrict the path through particular nodes
ダウンロード: 802
更新 2015/6/1

ライセンスの表示

As mentioned in summary, This function used to find shortest path, with the ability to restrict the path through particular nodes. This function used popular method, known as Dijkstra's Algorithm. This method can be use in various domains like: Networking problem (optical/Wireless), Currency Exchange Problem, TSP etc.
%---------------------------------------------------
% usage:
% [Path, Cost, Flag] = dijkstra(Graph, Source, Destination)
% or
% [Path, Cost, Flag] = dijkstra(Graph, Source, Destination, restrict2Nodes)
%
% example:
% Inputs:
% G = [0 10 3 0 0;
% 0 0 1 2 0;
% 0 4 0 8 2;
% 0 0 0 0 7;
% 0 0 0 9 0]; % Every element of Graph should be non-negetive
% S = 1; % Starting node of the path
% D = 4; % Ending node of the path
% r2N = [2 4 1]; % If you want to restrict path only to some of your
% distinguished node (other than Source and Destination) in the Graph, you can ignore this if you want to use
% the full Graph
%
% [c, p, f] = dijkstra(G, S, D, r2N); or
% [c, p, f] = dijkstra(G, S, D)
%
% Outputs:
% Path: Shortest path found by the algorithm, =[], if not found any path
% Cost: Total cost for the shortest path, =Inf, if not found any path
% Flag: 'Found' or 'Not Found' string depending upon path found or not found
%---------------------------------------------------

引用

Pramit Biswas (2024). dijkstra(Graph, Source, Destination, restrict2Nodes) (https://www.mathworks.com/matlabcentral/fileexchange/51038-dijkstra-graph-source-destination-restrict2nodes), MATLAB Central File Exchange. 取得済み .

MATLAB リリースの互換性
作成: R2006a
すべてのリリースと互換性あり
プラットフォームの互換性
Windows macOS Linux

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!
バージョン 公開済み リリース ノート
1.0.0.0

Check
help updated
Check