0

I have adjacency matrix,I don't know the location of the points only I know the adjacency matrix and distance between neighbors are equal.

so how I get the distance between points??:

is there any algorithm do that

2 Answers2

1

so how I get the distance between points??

In general, you can't, assuming you're using Euclidean distance as tagged. With the information you have given, you can't come up with a unique layout (embedding) of the graph.

As a small counter-example, take the adjacency matrix:

[0 1 1]
[1 0 0]
[1 0 0]

Vertex 1 is connected to Vertex 2 and Vertex 3 forming an angle. The angle between segments (1,2) and (1,3) can be anything we want from 0 ° to 180° making the distance between Vertices 2 and 3 between 0 and 2 units.

To come up with anything reasonable you'll have to impose some sort of layout on the graph first.

beaker
  • 16,331
  • 3
  • 32
  • 49
0

Since the adjacency matrix represents a graph, you need to traverse the graph to find the possible paths. You can do that using breadth-first search, since the graph is not weighted. keep in mind that the distance between some points might be infinite, since there might not be a path from one to another

blue_note
  • 27,712
  • 9
  • 72
  • 90