- Introduced by
- Edsger W. Dijkstra (shortest-path foundation)
- Year
- 1959
- Type
- Measurement of distance and travel cost along a network rather than straight-line
- Family
- Network analysis / routing
What does it do?
Network distance analysis measures how far apart places are along a real network of roads, paths, or rails, rather than in a straight line, because movement is constrained to edges and junctions.
Its core computation is the shortest-path problem, solved over a weighted graph by Dijkstra's algorithm (Dijkstra, 1959), and it extends to origin–destination cost matrices between many points. The resulting network distances and travel times are the realistic inputs to accessibility, routing, location, and flow analyses, and their ratio to straight-line distance, the detour or circuity index, shows how indirect a network is.
The intuition behind the method
Two houses can be close in a straight line yet far apart by travel, if the only crossing of a railway or river is a long way round. Straight-line distance hides this; network distance reveals it. The method ignores the empty space on the map and accumulates cost only along the lines people can use, until it reaches the destination by the cheapest route. Done once, this gives a route. Done from one origin to all destinations, it gives a vector of costs. Done for every origin–destination pair, it gives a cost matrix, the table that feeds accessibility and gravity models. Comparing network distance with straight-line distance then shows how circuitous the network forces travel to be.
History
The shortest-path foundation is Edsger Dijkstra's 1959 note, which gives an algorithm for the shortest path between nodes of a graph with non-negative weights (Dijkstra, 1959). Later point-to-point and heuristic variants build on this core, and the same single-source search underlies the one-to-many computations used to build origin–destination matrices.
When to use it
Use network distance analysis when the cost of moving between places depends on the available routes rather than on straight-line separation. Typical cases are routing and navigation, building travel-time matrices for accessibility and gravity models, optimising facility locations and delivery routes, computing service areas, and diagnosing network connectivity. It is the right choice when a routable network with credible edge costs is available and when barriers, one-way streets, or grid geometry make Euclidean distance misleading. It is less necessary when the study area or the question is so coarse that a straight-line approximation is adequate, or when no network data exist. Time-dependent congestion or scheduled transit requires a time-expanded or dynamic network, which goes beyond the static shortest-path model.
Limitations and considerations
- Accuracy is bounded by network completeness and the realism of edge costs and turn penalties.
- Static graphs ignore time-of-day congestion and dynamic conditions unless explicitly modelled.
- Full OD cost matrices grow with the product of origins and destinations and can be expensive to compute.
- Mode-specific networks (walking, cycling, transit) must be assembled separately and may be incomplete.
Source conditions do not replace independent scientific review or validation by an analysis engine.
Strengths
- Measures cost along the edges people can actually use, so barriers, one-way rules, and missing links enter the result where straight-line distance ignores them.
- Dijkstra's algorithm returns the optimal route for non-negative edge weights, and preprocessing methods such as contraction hierarchies speed up repeated queries on large networks.
- OD cost matrices feed directly into accessibility, gravity, location, and logistics models.
- The circuity index, the ratio of network to straight-line distance, measures network indirectness as a diagnostic in its own right.
Applications
- Computing travel-time and distance matrices as inputs to accessibility and gravity models.
- Routing and navigation: finding least-cost paths for vehicles, pedestrians, and cyclists.
- Optimizing facility locations and delivery or service routes in logistics.
- Defining network-based service areas and catchments for facilities.
- Diagnosing network connectivity and circuity to inform infrastructure planning.
How it works
How it works
The network is encoded as a weighted, usually directed graph G = (V, E): intersections and stops are vertices, the segments between them are edges, and each edge carries a non-negative weight w_e representing distance, travel time, or generalised cost. Realistic models add turn penalties, one-way restrictions, and junction impedances, so that a route's cost reflects the manoeuvres between segments as well as the segments themselves. The fidelity of this representation limits the realism of every downstream result. The choice of edge weight must match the research question: distance suits questions about physical length or effort, travel time suits accessibility and routing, and generalised cost combines time with monetary or comfort penalties. Time-based weights need speed profiles assigned by road class or mode, and the resulting costs should be checked against observed or reference travel times before the matrix is used.
Formula
G = (V, E),\quad w_e \ge 0,\ \text{plus turn/impedance costs}The network distance between an origin o and a destination d is the minimum total edge cost over all paths connecting them. It is computed with a shortest-path algorithm: Dijkstra's algorithm for non-negative weights, or A* with a geometric heuristic to speed up point-to-point queries. The algorithm settles vertices in order of increasing cost and relaxes their edges, which guarantees an optimal route. The output is both the least cost and the path that achieves it.
Formula
d_{net}(o, d) = \min_{\text{paths } o\to d} \sum_{e\in\text{path}} w_eMany analyses need the cost between every origin and every destination, not a single route. The origin–destination cost matrix M_ij stores d_net(o_i, d_j) for all origins i and destinations j. It is computed efficiently by running one single-source search from each origin (one-to-many), rather than repeating point-to-point queries. The matrix is the standard input to accessibility measures, gravity and spatial-interaction models, facility-location optimisation, and logistics planning.
Formula
M_{ij} = d_{net}(o_i, d_j)\quad \forall\, i \in O,\, j \in DThe detour or circuity index Q is the ratio of network distance to straight-line (Euclidean) distance between the same two points, where d_euclid(o, d) is the straight-line distance between o and d. Both distances should be measured in the same projected coordinate system so that they share units. Q is undefined when o and d coincide. A value near one means the network offers an almost direct route. Larger values flag indirectness caused by barriers, sparse connectivity, or street-grid geometry. Averaged over many pairs, the index characterises how efficient a network is and where detours are worst, and it shows when using network rather than Euclidean distance is necessary.
Formula
Q = \frac{d_{net}(o, d)}{d_{euclid}(o, d)}Common pitfalls
- Substituting Euclidean distance where barriers or grids make network distance substantially longer.
- Omitting one-way streets and turn restrictions, which requires a directed graph with impedances.
- Snapping origins and destinations to the wrong nearest edge, introducing systematic distance errors.
- Using uncalibrated constant speeds, so travel-time matrices misrepresent congested conditions.
- Choosing edge weights that do not match the question, for example using distance where travel time is the quantity of interest.
Frequently asked questions
When does network distance differ most from straight-line distance?
The gap is largest where the network forces detours: across rivers, railways, motorways, or coastlines with few crossings; in cul-de-sac or hierarchical street layouts; and in sparse rural networks. A regular street grid also produces a detour even without barriers, because travel must follow the streets at right angles, and the excess is largest for diagonal pairs of points. Where barriers or limited connectivity dominate, network distance can be considerably longer than the straight-line value. The circuity index quantifies this, and a high index signals that Euclidean distance would mislead.
What is an origin–destination cost matrix and why is it useful?
An OD cost matrix is a table giving the network travel cost, in distance or time, from every origin to every destination in two sets of points. It is computed efficiently with one one-to-many shortest-path search per origin. The matrix is the universal input to accessibility measures, gravity and spatial-interaction models, facility-location optimization, and logistics, because all of these need pairwise travel costs rather than single routes.
How does network distance analysis relate to isochrone analysis?
They share the same shortest-path engine but ask different questions. Network distance analysis computes costs between specified origin–destination pairs or full matrices, while isochrone analysis runs a single-source search and thresholds the result into reachable-area contours. An isochrone is essentially a one-to-all network-distance computation rendered as a map of reach, so the two are complementary and frequently combined in accessibility studies.
Related methods
Sources
Dijkstra, E. W. (1959). A note on two problems in connexion with graphs. Numerische Mathematik, 1(1), 269–271.
Open DOI reference