user3445090
user3445090

Reputation: 11

How can I get Euclidean distance matrix from adjacency matrix if the distance between neighbours is fixed to one

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

Upvotes: 0

Views: 1638

Answers (2)

beaker
beaker

Reputation: 16821

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.

Upvotes: 1

blue note
blue note

Reputation: 29099

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

Upvotes: 0

Related Questions