shortestpath for mesh nodes
3 次查看(过去 30 天)
显示 更早的评论
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 个评论
回答(3 个)
Walter Roberson
2016-6-22
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 个评论
skysky2000
2016-6-22
1 个评论
Walter Roberson
2016-6-23
https://www.mathworks.com/matlabcentral/newsreader/view_thread/341050
skysky2000
2016-6-23
3 个评论
Walter Roberson
2016-6-23
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?
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Construction 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!