# Find Distance Between Points That Have Only Relative Coordinates

Let's say I have an array of points, each of them defined by their distance to surrounding points, rather than by coordinates on a map. For instance, NY's location would be defined by its distance to Pennsylvania and Maryland, etc. And Washington is defined by its distance to Oregon and Idaho, etc.

Assuming each point is defined by a limited number of connections, how would I find the distance between two points that don't share connections, such as NY and WA?

The scenario is a map of node points in 3D space, and rather than defining their coordinates in terms of XYZ on a graph, I'm defining their distances between each other in terms of XYZ. So if Point A is in some location in space with a number of surrounding neighbors, and Point Z is in some other location in space with a number of other surrounding neighbors, I want to be able to find the distance between A and Z.

I've already considered a flood method, similar to how simpler pathfinding works, flooding a temporary connection map and finding the shortest path drawn and using that path to figure out a straight line distance. This method seems very costly, however.

• If the point dont have connections, you dont have any form to get their distance?? How supposedly you wil trace a straight line between them, if there is not a map??. Not clear at all. – Brethlosze Jun 8 '17 at 2:09
• Is dynamic programming relevant (stackoverflow.com/questions/1065433/what-is-dynamic-programming) ? – Jean Marie Jun 8 '17 at 2:13
• @hyprfrco No "straight lines" ; consider this issue as a graph theory problem. – Jean Marie Jun 8 '17 at 2:14
• "using that path to figure out a straight line distance" – Brethlosze Jun 8 '17 at 2:17
• @hyprfrco you are right, I didn't notice. The OP must "downgrade" his expectations. He/she will get at best larger distances than straight line distances. – Jean Marie Jun 8 '17 at 2:22