File Exchange

image thumbnail

Dijkstra Shortest Path Routing

version 1.0.0.0 (1.13 KB) by Xiaodong Wang
This function and example show shortest path routing based on Dijkstra algorithm.

16 Downloads

Updated 29 Jul 2004

No License

This function performs Dijkstra algorithm based on the cost matrix, and shortest path can be found.

Cite As

Xiaodong Wang (2021). Dijkstra Shortest Path Routing (https://www.mathworks.com/matlabcentral/fileexchange/5550-dijkstra-shortest-path-routing), MATLAB Central File Exchange. Retrieved .

Comments and Ratings (53)

Jens Filtenborg Buhl

nana bu

报错Error: Missing MATLAB operator.是怎么回事

Byron Bolaños

PLEASE the file

channa Silva

it is helpful

SUSHANTA KUMAR PATI

Really i can't run it. it shows following error

index out of bounds because numel(W)=1.
Error in dijkstra (line 52)
e=W(size(W,1),d);

so next what can i do please suggest me ,its urgent.send me at my mail-sushantakumarpati@gmail.com

Zhang Huiyuan

So bad, no description on each variable!! Cant get how to use it!!!

samantha crazy

Hi, I am trying to work on a project to find the best shotest path alogrithm in performance between DIJKSTRA AND BELLFORD algorithms. I even have code but don't know how to run it. Can someone please help me.

Thanks.

Cosy

Upps, commented the wrong file
Sorry for that...

Cosy

Hi there,

what is wrong with this example:

G = [ 0 1 2;
1 0 0;
2 0 0 ]

dijkstra(G,2,3);

result: [3 2 2]

Can you help me?

Yousof

How can I use it?

Hannif Mardani

good

alex

can you send me at my email (alex-mr-93@hotmail.com) how the code works ?? urgently please!!

Raeanne

I'm having trouble using this for large datasets - it works fine for 10 start/end points, but take that up an to 1000 startpoints and endpoints, and my computer almost always runs out of memory. Any way to make it more efficient would be much appreciated.

Barsam

Really helped me, thanks!

Jesus Luevano

anyone can help to solve a problem with this algorithm!

MAOFAN

Well done

Meg

can you please define the input such as farthestPreviousHop, farthestNextHop, and netcostmatrix?

Hakk1

well

Fardeen

well done

LA

giorgio

giorgio

Chandra Kurniawan

wonderfull

Seifi

I met this Error in running the code:

??? Index exceeds matrix dimensions.
Error in ==> dijkstra at 77
if ( ( netCostMatrix(u, v) + distance(u)) < distance(v) )

Could you please tell me how do you define the input?

Rick

Matthew Bays

Worked great the first time!

Ying liu

Alexander Wallar

im new to MATLAB and i was just wondering if you could give an example?

Maxime

avdo tukic

Rolf Bartstra

Poor (or no!) description of input/output parameters. For large nr of nodes, n, the netCostMatrix (nxn) may require vast amounts of memory; a link-based description may be more appropriate in this case (e.g. algorithm by Joseph Kirk)

ai yu

very good

neha r

good

khld ab

chrystal Amutha

good

momo juju

hanan soliman

shankar velmurugan

good but need more comments to explain the m file

Brevetti Ge

I'm Italian...
what are "farthest..." , "...previous?"...
Help me, please...

Eyup Cinar

Good! but can be excellent with more comments and details inside the codes.It would be better to see more explanatory m file here.

Shahzada Rasool

good example, but farthestNextHop and PreviousHop should be explained

Joseph Kirk

This was very nice and I wanted to give it a 5, but when I changed the random state a couple times, the algorithm did not always find the shortest path... so I wonder if there is a bug that need to be fixed? (rand states = 1, 2, 4, 8 and 10 were the ones I checked that appeared to have an obviously shorter route than the one shown)

An Vincint

I appreciate it very much!

john bautista

very good

achilles boursianis

lydiah asere

samy jojo

not too bad

Alg Searcher

Babis Grouzakis

excellent work,i have to study it carefully,step by step.

sanith Wijesinghe

egis cioperiux

Andrew Wagner

Worked beautifully. Not sure what the last couple parameters are for, but they can be initialized according the the commented out usage example at the top of the file.

lili Woo

It is good that results are showed.

MATLAB Release Compatibility
Created with R12
Compatible with any release
Platform Compatibility
Windows macOS Linux

Community Treasure Hunt

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

Start Hunting!