Distance
from 0 to 1 is 1.0
from 1 to 2 is 3.0
from 0 to 2 is 2.0
D = [
[ 0, 1.0, 2.0],
[ 1.0, 0, 3.0],
[ 2.0, 3.0, 0]
]
So I've got a matrix which looks like one above.
But I can't quite see why those measures are like the ones given at the top of my post?
How is distance from 0 to 1 is 1.0?
Ah... this is a pre-loaded distance array.
Say for instance that point 0 is (5,0), point 1 is (4,0), and point 2 is (7,0). Then D is preloaded with inter-point distances, ie D[from_point][to_point] = distance(from_point, to_point)
.
Then you can refer to the matrix rather than having to recalculate distances.