Find distance between nodes
22 views (last 30 days)
Show older comments
Tha saliem on 3 Jun 2017
Commented: Waseem AL Aqqad on 24 Jan 2021
Hi i have a dataset of 1853 rows and 2 columns, sample of dataset is as follows:
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.
Any help will be greatly appreciated.
Walter Roberson on 3 Jun 2017
To calculate just the distances, use https://www.mathworks.com/help/matlab/ref/graph.distances.html
To get the tree of distances from a node like you show, see https://www.mathworks.com/help/matlab/ref/graph.shortestpathtree.html
More Answers (0)
Find more on Graph and Network Algorithms in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!Start Hunting!