Algorithms used by Network Analyst

The routing solvers in the ArcGIS Network Analyst extension—namely the Route, Closest Facility, and OD Cost Matrix solvers—are based on the well-known Dijkstra's algorithm for finding shortest paths. Each of these solvers implements two types of path-finding algorithms. The first type is the exact shortest path, and the second is a hierarchical path solver for faster performance. The classic Dijkstra's algorithm solves a shortest-path problem on an undirected, nonnegative, weighted graph. To use it in the context of real-world transportation data, this algorithm is modified to respect user settings such as one-way restrictions, turn restrictions, junction impedance, barriers, and side-of-street constraints while minimizing a user-specified cost attribute. The performance of Dijkstra's algorithm is further improved by using better data structures such as d-heaps. In addition, the algorithm must model the locations anywhere along an edge, not just on junctions.

Dijkstra's algorithm

The classic Dijkstra's algorithm solves the single-source, shortest-path problem on a weighted graph. To find a shortest path from a starting location, s, to a destination location, d, Dijkstra's algorithm maintains a set of junctions, S, whose final shortest path from s has already been computed. The algorithm repeatedly finds a junction in the set of junctions that has the minimum shortest-path estimate, adds it to the set of junctions S, and updates the shortest-path estimates of all neighbors of this junction that are not in S. The algorithm continues until the destination junction is added to S.


Route uses the well-known Dijkstra's algorithm described above.

Learn more about finding the best route

Closest Facility

Closest Facility uses a multiple-origin, multiple-destination algorithm based on Dijkstra's algorithm. It has options to only compute the shortest paths if they are within a specified cutoff or to solve for a fixed number of closest facilities.

Learn more about finding the closest facility

OD Cost Matrix

OD Cost Matrix uses a multiple-origin, multiple-destination algorithm based on Dijkstra's algorithm. It has options to only compute the shortest paths if they are within a specified cutoff or to solve for a fixed number of closest destinations. The OD Cost Matrix solver is similar to the Closest Facility solver but differs in that it does not compute the shape of the resulting shortest path for less overhead and faster performance.

Learn more about creating an OD cost matrix

Hierarchical routing

Finding the exact shortest path on a nationwide network dataset is time-consuming due to the large number of edges that need to be searched. To improve performance, network datasets can model the natural hierarchy in a transportation system where driving on an interstate highway is preferable to driving on local roads. Once a hierarchical network has been created, a modification of the bidirectional Dijkstra is used to compute a route between an origin and a destination.

The overall objective here is to minimize the impedance while favoring the higher-order hierarchies present in the network. Hierarchical routing does this by simultaneously searching from both origin and destination locations, as well as connection or entry points into higher-level roads, and then searching the higher-level roads until segments from both origin and destination meet. As the search is restricted to the upper hierarchy, a smaller number of edges are searched, resulting in faster performance. Note that this is a heuristic algorithm; its goal is fast performance and good solutions, but it does not guarantee that the shortest path will be found. For this heuristic to be successful, the top-level hierarchy must be connected, as it will not descend to a lower level if a dead end is reached.

Generally, it makes sense to use this solver on a hierarchical network where the edge weights are based on travel time. This mimics the way people normally drive on a highway network.

Learn more about network analysis with hierarchy

Traveling salesman problem option for the Route solver

The Route solver has the option to generate the optimal sequence of visiting the stop locations. This is the traveling salesman problem, or TSP. The TSP is a combinatorial problem, meaning there is no straightforward way to find the best sequence. Heuristics are used to find good solutions to these types of problems in a short amount of time. The TSP implementation in Network Analyst also handles time windows on the stops; that is, it finds the optimal sequence to visit the stops with a minimum amount of lateness.

The traveling salesman solver starts by generating an origin-destination cost matrix between all the stops to be sequenced and uses a tabu search-based algorithm to find the best sequence of visiting the stops. Tabu search is a metaheuristic algorithm for solving combinatorial problems. It falls in the realm of local search algorithms. The exact implementation of the tabu search is proprietary, but it has been researched and developed extensively at Esri to quickly yield good results.

Learn more about finding the best route

Vehicle routing problem with time windows

The vehicle routing problem (VRP) is a superset of the TSP. In a TSP, one set of stops is sequenced in an optimal fashion. In a VRP, a set of orders must be assigned to a set of routes or vehicles such that the overall path cost is minimized. It also must honor real-world constraints including vehicle capacities, delivery time windows, and driver specialties. The VRP produces a solution that honors these constraints while minimizing an objective function composed of operating costs and user preferences, such as the importance of meeting time windows.

The VRP solver starts by generating an origin-destination matrix of shortest-path costs between all order and depot locations along the network. Using this cost matrix, it constructs an initial solution by inserting the orders one at a time onto the most appropriate route. The initial solution is then improved by resequencing the orders on each route, as well as moving orders from one route to another, and exchanging orders between routes. The heuristics used in this process are based on a tabu search metaheuristic and are proprietary, but they have been under continual research and development at Esri for many years and quickly yield good results.

Learn more about vehicle routing problem

Service area

The service area solver is also based on Dijkstra's algorithm to traverse the network. Its goal is to return a subset of connected edge features such that they are within the specified network distance or cost cutoff. In addition, it can return the lines categorized by a set of break values that an edge may fall within. The service area solver can generate lines, polygons surrounding these lines, or both.

The polygons are generated by buffering the lines by a user-provided distance. Optionally, users can create high-quality polygons such that the polygons contain all the area that is closer to the traversed lines than the nontraversed lines, up to a user-provided distance.

Learn more about calculating a service area


Location-allocation is a solver for the facility location problem. That is, given N candidate facilities and M demand points with a weight, choose a subset of the facilities, P, such that the sum of the weighted distances from each M to the closest P is minimized. This is a combinatorial problem of the type N choose P, and the solution space grows extremely large. Optimal solutions cannot be obtained by examining all of the combinations. For example, even a small problem such as 100 choose 10 contains over 17 trillion combinations. In addition, the location-allocation solver has options to solve a variety of location problems such as to minimize weighted impedance, maximize coverage, or achieve a target market share. Heuristics are used to solve the location-allocation problems.

The location-allocation solver starts by generating an origin-destination matrix of shortest-path costs between all the facilities and demand point locations along the network. It then constructs an edited version of the cost matrix by a process known as Hillsman editing. This editing process enables the same overall solver heuristic to solve a variety of problem types. The location-allocation solver then generates a set of semirandomized solutions and applies a vertex substitution heuristic (Teitz and Bart) to refine these solutions, creating a group of good solutions. A metaheuristic combines this group of good solutions to create better solutions. When no additional improvement is possible, the metaheuristic returns the best solution found. The combination of an edited matrix, semirandomized initial solutions, a vertex substitution heuristic, and a refining metaheuristic quickly yields near-optimal results.

Learn more about performing a location-allocation analysis