How to calculate euclidean distance to each point/node in directed graph?
6 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Khoirunnisya Zawawi
am 30 Sep. 2016
Beantwortet: Steven Lord
am 30 Sep. 2016
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 Kommentare
Akzeptierte Antwort
Steven Lord
am 30 Sep. 2016
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 Kommentare
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Graph and Network Algorithms finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!