# All possible routes from point A to point B - how to generate?

2681
8
11-28-2012 09:39 AM
Occasional Contributor
Hello guys,

I need to generate all possible routes (means not only the shortest one) between to given points (A, B) within a given network dataset and produce an instruction for each a each of these routes.  Is it any way to do it with Network Analyst?

Anton
Tags (2)
8 Replies
New Contributor III
I'm not sure if there's a way to do all the possible routes.  But I do know that you can do the shortest distance and the shortest time.  It'll also produce a step-by-step turn/directions.
Regular Contributor III
Hi,

Why would you need to generate such a list of possible routes? Is there any particular application of the results you keep in mind? Are there any restrictions you have regarding the traversing road links (like if there is already one route traversing a certain link the next one cannot use it anymore and similar)? If not, the possible combination of routes will be extreme (think of a network dataset with n traversable edges - you can think that you will get something close to n! (e.g., n=10, n!=3628800 routes possible - just to give you a feeling) of possible routes particularly when the solver can go through the traversed edges either in the current solution or previous ones).

But if you have (or plan to implement) some logic regarding the solving, then you might actually get some relevant results.
Esri Regular Contributor
There can be an infinite number of paths between two locations on any reasonable size of network data. So you have to define what you really mean my ALL possible routes.

One way to generate different paths is to use the scaled line barrier concept. So you solve the route once to get the shortest path. Then use load locations to load the resulting route as a Line Barrier and set it as scaled cost with a scale of 1.1 (ten percent more) and re-solve. This will most likley give you a second path. You can repeate this process by changing the scaled cost to 1.2, then 1.3, etc. Once you are done with this, you can add on the second best path as an additional scaled cost and iterate over that. It can all be done in a model builder.

Jay Sandhu
New Contributor III

can you explain more the idea of 1.2, then 1.3, etc. please . Thanks

New Contributor II

This is a dang innovative solution. Hats off to you sir. I love this

Esri Regular Contributor

If you find a shortest path from location A to B and now want to find another path, you can make the shortest path a little slower and solve again! To make the path slower, you can take the output of the route solve and load it as a line barrier into the same route analysis layer. You can set it to be a scaled cost barrier and set the scale to be 10 percent higher. So, you can set the scale as 1.1, that is all costs of lines under that line barrier will be multiplied by 1.1 or ten percent more. Solve. You should get a different path. Now take the route output and again add it as a scaled cost line barrier with scaled cost of 1.1 and solve. So roads that are common will now be scaled 20 percent. OR you could have taken the first line barrier and changed its scale to 1.2 and solve may give you another path.

This is a good way to generate some alternate paths. But not a good way to generate ALL paths.

Jay Sandhu

New Contributor III

Actually, I want to create a model for that . A model that can allow me to found all paths possible from point A to point B (inside an area that i want to close all road lead on it )

Esri Regular Contributor

There is NO way to generate all possible paths from A to B as there can be an infinite number of paths. I still think you are not approaching the problem in the right way. If you have a start location A and a destination polygon area B and you want to cut access to B, then one way to do this is to use the BUFFER tool and buffer the B polygon area by some value like 100 meters. Then convert the buffer polygon to a line and load that line as a line barrier into your route analysis. This will stop all paths going into B. The other option was as I mentioned in the other email, use service area lines to find lines that connect to B and place restrictions on them.

If this is not what you have in mind, please explain to me how the solution will look like?

Jay Sandhu