shortestpath for mesh nodes
3 views (last 30 days)
Show older comments
hello guys, how can i get shortestpath for mesh nodes, i have 50 nodes and i want to calculate the shortest path between all those nodes help please.
0 Comments
Answers (3)
Walter Roberson
on 22 Jun 2016
If you have R2015b or later, convert your mesh to a weighted graph and loop over all of the nodes in your graph using http://www.mathworks.com/help/matlab/ref/graph.shortestpathtree.html each time.
This will give you 50 trees, each with 49 paths, and each of the 49 paths could be as long as 49 elements (but probably would not be more than 14 elements if you have a square mesh.) A quick estimate is that it could be over 30000 pieces of information. I wonder if you actually need that information?
Ah yes, checking your other questions I see that you are doing WSN, in which case you would generally not hold on to that information. Depending on which routing protocol you are using, what each node needs to know is not the exact path to send to each other node, but instead just which of its neighbours it needs to send the packet to in order for the packet to reach the destination. WSN is not infrequently used in a situation where links go into and out of use, or might even move, so a pre-computed static routing table is not typically used.
0 Comments
skysky2000
on 22 Jun 2016
1 Comment
Walter Roberson
on 23 Jun 2016
https://www.mathworks.com/matlabcentral/newsreader/view_thread/341050
skysky2000
on 23 Jun 2016
3 Comments
Walter Roberson
on 23 Jun 2016
To connect the nodes by program, you need to define your geometry and your distance function. What information do you have available? x and y coordinates and you want to use Euclidean distance? Is there a cutoff beyond which two nodes are to be considered to not be directly connected?
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!