Find distance between nodes
7 次查看(过去 30 天)
显示 更早的评论
Hi i have a dataset of 1853 rows and 2 columns, sample of dataset is as follows:
1 105
1 104
2 1100
10 1165
813 1320
15 105
19 90
105 813
i want to create a graph to find distance between each node from other. For example if i enter input node 1, it will show that distance between 1 and 105 is 1, and between 1 and 813 is 2 (because it will come next to 105). and between 1 and 1320 is 3. (as shown in image below). and similarly for other nodes.
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/164816/image.bmp)
Any help will be greatly appreciated.
0 个评论
采纳的回答
Walter Roberson
2017-6-3
To get the tree of distances from a node like you show, see https://www.mathworks.com/help/matlab/ref/graph.shortestpathtree.html
4 个评论
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Graph and Network Algorithms 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!