shortestpath for mesh nodes

3 次查看(过去 30 天)
skysky2000
skysky2000 2016-6-22
评论: skysky2000 2016-6-23
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.

回答(3 个)

Walter Roberson
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.

skysky2000
skysky2000 2016-6-22
Thanks Walter, I tried your solution but unfortunately my version 2015a doesn't support graph function. any other solution please?

skysky2000
skysky2000 2016-6-23
thanks walter, i had this link, but the problem with this i have to connect my nodes manual .
  3 个评论
Walter Roberson
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?
skysky2000
skysky2000 2016-6-23
thank you very much... I am gonna work with it

请先登录,再进行评论。

类别

Help CenterFile Exchange 中查找有关 Construction 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by