# Making stops not in certain sequence in order to find shortest route with ArcGIS Network Analyst?

Is it possible to make stops not in a certain sequence in order to find the shortest route with the network analyst?

I now use the small green points as an input stops because I want the lines with a pink dot beside it in the route. Then I reorder them and don't preserve the end and startpoint. I thought this meant that the network analyst doesn't make a real sequence of the input stops and doesn't choose a real start and end point, and just finds the shortest route in between the points.

However if I look at the output of the tool (light green), it seems like the network analyst tool still uses a kind of sequence and begin and endpoint. Because in the picture it looks like the point where the blue arrow points to is a start or end point. The red line is the route I want. So the route makes a round now (at the left where the black arrow is) going past the south segment instead of going to the north and connect via the small grey link near the blue arrow (like the red route I want). The green output I now receive is not the shortest route.

I thought that one problem could be that the point near the blue arrow is assigned by the tool as start or end point and the other problem that the network analyst takes segment near the black arrow because the point in the south west (black circle) comes later in the sequence than the point in the middle (black circle). So, it gives each point 1,2,3 and so on, instead of tread them like all 0,0,0. So, I thought that this could be solved by having the stops as equal points (all zeros or something) and calculating the shortest route in between those instead of having the stops as a sequence and going from 1 to 2 and 3 and so on. But I don't know if this is right, see also last comment of @ChrisW, Using line feature as stops input in network analyst?.

As I mentioned in a comment at your other question, once you allow the tool to reorder stops the numerical order of the stop points no longer matters as it will reorder them to the shortest route with as little backtrack as possible. Hence there is no sequence to them initially. As I also mentioned in a comment, what you really want it to do is order pairs (or now groups) of stops. Note that you can preserve the start and end points and let it reorder everything else in between to retain some control over the route. If you don't specify a start or end point, it will simply pick them based on whatever the shortest possible route between all points is - but the route still has to start and end somewhere.

If you set a different start point, say the lower left circled point or the far upper right point you may get a different result. Right now I can't see where the route starts and ends, or what directions it's taking. You suspect, according to your question, it's starting at the blue arrow point, but what you really need to do is symbolize your route line with directional arrows so you can actually see what it's actually doing. It could be starting in the upper right corner and going opposite your black arrow. It hits that intersection and determines that it's shorter to bypass that edge and go around counter-clockwise than to out-and-back it because it's still going to end up at the central circled point. Your way repeats four segments of that edge, while the solver only repeats three (but never hits one in the first place), hence it's a shorter route.

In the above edit of your image, the orange line is shorter than the magenta line by 2x the length of the yellow line (that edge segment that didn't get traversed). So it's still hit all the points, but it did it in a shorter route.

Because you're wanting an entire edge to be visited, you've added stops along that edge. They're not really stops, just a way to force the route to go the direction you want or make sure it visits the entire edge. In such a case what you're really wanting the route solver to do is find the shortest route between groups of points, allowing it to reorder the groups but not within the group - and I don't know of a way to do that without building the route one leg at a time. That means you'd define a start point and go to the first edge start point and let it solve that. Then you'd do another solve from that edge's end point to all the other edge start points. It would go to the nearest one, then you'd run yet another solver from that edge's endpoint to the remaining edge start points, and so on.

There are two other settings that might help with this - U-turns and Curb-Approach. If properly configured, at least based on that help file, you can set it so U-turns are only allowed at intersections. This means if you create your stop points at the midpoint of the line it wouldn't be able to turn around at the stop and would force the route to go all the way to the next intersection before turning around. That would ensure that the entire edge you want to visit is included.