Label correcting algorithm for shortest path
Show older comments
Would you please write a code for Label correcting algorithm for shortest path??
11 Comments
Walter Roberson
on 17 Sep 2015
Walter Roberson
on 17 Sep 2015
The present version of your Question sounds like you are asking us to write code for a homework assignment for you. That is not the purpose of MATLAB Answers: MATLAB Answers is about the MATLAB language. We will help you interpret error messages and help you find information in the documentation, but we will seldom just write non-trivial code for you.
Walter Roberson
on 17 Sep 2015
See also "Label-Correcting Shortest Path Algorithms Revisited. María G. Bardossy, Douglas R. Shier". They implemented in MATLAB. I do not know if you will be able to find their full paper for free but you can read parts of it.
nazi hafez
on 19 Sep 2015
Steven Lord
on 19 Sep 2015
There are a lot of good suggestions for how to learn MATLAB in this Answer. Once you've read through that thread (and possibly some of the resources linked there) then give implementing your algorithm a shot. Some of the new graph algorithm tools introduced in release R2015b may help you with your implementation. If you get stuck during your implementation, come back to MATLAB Answers, show where you're stuck, and ask a specific question about the difficulty and someone will probably give you a nudge in the right direction.
nazi hafez
on 20 Sep 2015
Edited: Walter Roberson
on 20 Sep 2015
Walter Roberson
on 20 Sep 2015
You can represent your set of arcs as a cell array. Or, since you will have the same amount of information for each arc, you can use a 2 dimensional numeric array. For example if for each arc you have the Source, Destination, and Cost, then you could represent as an array of three columns, such as
[1 2 5; %node 1 to 2, cost 5
1 4 3; %node 1 to 4, cost 3
2 5 2] %node 2 to 5, cost 2
Then arc #3 would be the third row of this array.
Alex Taylor
on 28 Sep 2015
Walter, if the OP is interesting in a graph theory representation of solving this, they should look at the brand new graph functionality that went into R2015b (assuming they have R2015b).
Specifically, there are several functions related to computing shortest path problems.
Alternatively, they could just use the IPT function bwdistgeodesic if they want to use a more simple image-based approach to the problem.
Walter Roberson
on 28 Sep 2015
Interesting, Alex; I had not noticed those yet.
nazi hafez
on 6 Nov 2015
Image Analyst
on 6 Nov 2015
Did you see Alex's comment above? Did you try anything yourself? (If we had any code all ready to go, we would have given it to you.)
Answers (1)
Image Analyst
on 19 Sep 2015
0 votes
If you want to learn about MATLAB's capabilities, with code examples, for shortest path, see Steve's blog series: http://blogs.mathworks.com/steve/2011/11/01/exploring-shortest-paths-part-1/
Categories
Find more on Graph and Network Algorithms in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!