Forum Discussion
Finding intermediary routes automatically in map
Hi all,
I'm tasked with creating a map that allows Sales to determine building connection routes. I have a list of so called presence points;
a building which is a central location and connects via cable to other buildings that belong to us (a direct route).
However, not all of the buildings in the list connect directly to every other building in the list (see below example, Frankfurt and London)
If I overlay the two buildings, I can see that they both go to Amsterdam, but to separate buildings in Amsterdam, so to create a route between London and Frankfurt, there'd need to be a 3rd connection in Amsterdam (London -> Amsterdam. Amsterdam <- - ->Amsterdam. Amsterdam -> Frankfurt
What I'd like to be able to do is select 2 buildings (A and Z end) and the map to calculate the route (with all the intermediary hops) and not require sales to figure out the 3rd, 4th or 5th potential hops to connect the buildings. This is akin to creating a train journey planner; select a starting point and destination, and the 'behind-the-scenes magic' calculates the route and all the stations the train passes through to get there.
Any advice would be greatly appreciated!
1 Reply
- AlexisOlson
Super User
Dijkstra's algorithm and the A* search are the classic solutions to the Shortest Path Problem. However, these are not going to be easy to implement in DAX due to their recursive nature. I'd recommend pre-computing all pairs upstream of DAX (using your preferred programming language) by implementing Floyd-Warshall or Johnson's algorithm.