How to calculate euclidean distance to each point/node in directed graph?
1 次查看(过去 30 天)
显示 更早的评论
I want to find euclidean distance of each point in directed graph that i already made. Can someone show me the efficient and an easy to understand way to do it? thank you..
this is my graph :
s = [ 1 2 2 3 4 4 5 6 6 7 8 8 9 10]
t = [ 2 3 4 11 5 6 11 7 8 11 9 10 11 11]
X = digraph(s, t)
0 个评论
采纳的回答
Steven Lord
2016-9-30
I think what you're looking for is the distances method. If instead you've plotted the digraph using its plot method, you can obtain the coordinates of the vertices from the object plot returns and use those to set weights (lengths) on the edges on the digraph object then call distances.
I'm assuming that you want the distances between the nodes along the edges (as the car drives) rather the straight line distance between two nodes that are not connected (as the crow flies.)
0 个评论
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Directed Graphs 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!