
Ingraph algorithms, thewidest path problem is the problem of finding apath between two designatedvertices in aweighted graph, maximizing the weight of the minimum-weight edge in the path. The widest path problem is also known as themaximum capacity path problem. It is possible to adapt mostshortest path algorithms to compute widest paths, by modifying them to use the bottleneck distance instead of path length.[1] However, in many cases even faster algorithms are possible.
For instance, in a graph that represents connections betweenrouters in theInternet, where the weight of an edge represents thebandwidth of a connection between two routers, the widest path problem is the problem of finding an end-to-end path between two Internet nodes that has the maximum possible bandwidth.[2] The smallest edge weight on this path is known as the capacity or bandwidth of the path. As well as its applications in network routing, the widest path problem is also an important component of theSchulze method for deciding the winner of a multiway election,[3] and has been applied todigital compositing,[4]metabolic pathway analysis,[5] and the computation ofmaximum flows.[6]
A closely related problem, theminimax path problem orbottleneck shortest path problem asks for the path that minimizes the maximum weight of any of its edges. It has applications that includetransportation planning.[7] Any algorithm for the widest path problem can be transformed into an algorithm for the minimax path problem, or vice versa, by reversing the sense of all the weight comparisons performed by the algorithm, or equivalently by replacing every edge weight by its negation.
In anundirected graph, a widest path may be found as the path between the two vertices in themaximum spanning tree of the graph, and a minimax path may be found as the path between the two vertices in the minimum spanning tree.[8][9][10] It follows immediately from this equivalence that all pairs widest paths in an-vertex undirected graph can be computed in time.[11]
In any graph, directed or undirected, there is a straightforward algorithm for finding a widest path once the weight of its minimum-weight edge is known: simply delete all smaller edges and search for any path among the remaining edges usingbreadth-first search ordepth-first search. Based on this test, there also exists alinear timealgorithm for finding a widests-t path in an undirected graph, that does not use the maximum spanning tree. The main idea of the algorithm is to apply the linear-time path-finding algorithm to themedian edge weight in the graph, and then either to delete all smaller edges or contract all larger edges according to whether a path does or does not exist, and recurse in the resulting smaller graph.[9][12][13]
Fernández, Garfinkel & Arbiol (1998) use undirected bottleneck shortest paths in order to formcompositeaerial photographs that combine multiple images of overlapping areas. In the subproblem to which the widest path problem applies, two images have already beentransformed into a common coordinate system; the remaining task is to select aseam, a curve that passes through the region of overlap and divides one of the two images from the other. Pixels on one side of the seam will be copied from one of the images, and pixels on the other side of the seam will be copied from the other image. Unlike other compositing methods that average pixels from both images, this produces a valid photographic image of every part of the region being photographed. They weigh the edges of agrid graph by a numeric estimate of how visually apparent a seam across that edge would be, and find a bottleneck shortest path for these weights. Using this path as the seam, rather than a more conventional shortest path, causes their system to find a seam that is difficult to discern at all of its points, rather than allowing it to trade off greater visibility in one part of the image for lesser visibility elsewhere.[4]
A solution to the minimax path problem between the two opposite corners of agrid graph can be used to find theweak Fréchet distance between twopolygonal chains. Here, each grid graph vertex represents a pair of line segments, one from each chain, and the weight of an edge represents the Fréchet distance needed to pass from one pair of segments to another.[14]
If all edge weights of an undirected graph arepositive, then the minimax distances between pairs of points (the maximum edge weights of minimax paths) form anultrametric; conversely every finite ultrametric space comes from minimax distances in this way.[15] Adata structure constructed from the minimum spanning tree allows the minimax distance between any pair of vertices to be queried in constant time per query, usinglowest common ancestor queries in aCartesian tree. The root of the Cartesian tree represents the heaviest minimum spanning tree edge, and the children of the root are Cartesian treesrecursively constructed from the subtrees of the minimum spanning tree formed by removing the heaviest edge. The leaves of the Cartesian tree represent the vertices of the input graph, and the minimax distance between two vertices equals the weight of the Cartesian tree node that is their lowest common ancestor. Once the minimum spanning tree edges have been sorted, this Cartesian tree can be constructed in linear time.[16]
Indirected graphs, the maximum spanning tree solution cannot be used. Instead, several different algorithms are known; the choice of which algorithm to use depends on whether a start or destination vertex for the path is fixed, or whether paths for many start or destination vertices must be found simultaneously.
The all-pairs widest path problem has applications in theSchulze method for choosing a winner in multiwayelections in which voters rank the candidates inpreference order. The Schulze method constructs acomplete directed graph in which the vertices represent the candidates and every two vertices are connected by an edge. Each edge is directed from the winner to the loser of a pairwise contest between the two candidates it connects, and is labeled with the margin of victory of that contest. Then the method computes widest paths between all pairs of vertices, and the winner is the candidate whose vertex has wider paths to each opponent than vice versa.[3] The results of an election using this method are consistent with theCondorcet method – a candidate who wins all pairwise contests automatically wins the whole election – but it generally allows a winner to be selected, even in situations where the Condorcet method itself fails.[17] The Schulze method has been used by several organizations including theWikimedia Foundation.[18]
To compute the widest path widths for all pairs of nodes in adense directed graph, such as the ones that arise in the voting application, theasymptotically fastest known approach takes timeO(n(3+ω)/2) where ω is the exponent forfast matrix multiplication. Using the best known algorithms for matrix multiplication, this time bound becomesO(n2.688).[19] Instead, the reference implementation for the Schulze method uses a modified version of the simplerFloyd–Warshall algorithm, which takesO(n3) time.[3] Forsparse graphs, it may be more efficient to repeatedly apply a single-source widest path algorithm.
If the edges are sorted by their weights, then a modified version ofDijkstra's algorithm can compute the bottlenecks between a designated start vertex and every other vertex in the graph, in linear time. The key idea behind the speedup over a conventional version of Dijkstra's algorithm is that the sequence of bottleneck distances to each vertex, in the order that the vertices are considered by this algorithm, is amonotonic subsequence of the sorted sequence of edge weights; therefore, thepriority queue of Dijkstra's algorithm can be implemented as abucket queue: an array indexed by the numbers from 1 tom (the number of edges in the graph), where array celli contains the vertices whose bottleneck distance is the weight of the edge with positioni in the sorted order. This method allows the widest path problem to be solved as quickly assorting; for instance, if the edge weights are represented as integers, then the time bounds forinteger sorting a list ofm integers would apply also to this problem.[13]
Berman & Handler (1987) suggest that service vehicles and emergency vehicles should use minimax paths when returning from a service call to their base. In this application, the time to return is less important than the response time if another service call occurs while the vehicle is in the process of returning. By using a minimax path, where the weight of an edge is the maximum travel time from a point on the edge to the farthest possible service call, one can plan a route that minimizes the maximum possible delay between receipt of a service call and arrival of a responding vehicle.[7]Ullah, Lee & Hassoun (2009) use maximin paths to model the dominant reaction chains inmetabolic networks; in their model, the weight of an edge is the free energy of the metabolic reaction represented by the edge.[5]
Another application of widest paths arises in theFord–Fulkerson algorithm for themaximum flow problem. Repeatedly augmenting a flow along a maximum capacity path in the residual network of the flow leads to a small bound,O(m logU), on the number of augmentations needed to find a maximum flow; here, the edge capacities are assumed to be integers that are at mostU. However, this analysis does not depend on finding a path that has the exact maximum of capacity; any path whose capacity is within a constant factor of the maximum suffices. Combining this approximation idea with the shortest path augmentation method of theEdmonds–Karp algorithm leads to a maximum flow algorithm with running timeO(mn logU).[6]
It is possible to find maximum-capacity paths and minimax paths with a single source and single destination very efficiently even in models of computation that allow only comparisons of the input graph's edge weights and not arithmetic on them.[13][20] The algorithm maintains a setS of edges that are known to contain the bottleneck edge of the optimal path; initially,S is just the set of allm edges of the graph. At each iteration of the algorithm, it splitsS into an ordered sequence of subsetsS1,S2, ... of approximately equal size; the number of subsets in this partition is chosen in such a way that all of the split points between subsets can be found by repeated median-finding in timeO(m). The algorithm then reweights each edge of the graph by the index of the subset containing the edge, and uses the modified Dijkstra algorithm on the reweighted graph; based on the results of this computation, it can determine in linear time which of the subsets contains the bottleneck edge weight. It then replacesS by the subsetSi that it has determined to contain the bottleneck weight, and starts the next iteration with this new set S. The number of subsets into whichS can be split increases exponentially with each step, so the number of iterations is proportional to theiterated logarithm function,O(log*n), and the total time isO(mlog*n).[20] In a model of computation where each edge weight is a machine integer, the use of repeated bisection in this algorithm can be replaced by a list-splitting technique ofHan & Thorup (2002), allowingS to be split intoO(√m) smaller setsSi in a single step and leading to a linear overall time bound.[21]

A variant of the minimax path problem has also been considered for sets of points in theEuclidean plane. As in the undirected graph problem, this Euclidean minimax path problem can be solved efficiently by finding aEuclidean minimum spanning tree: every path in the tree is a minimax path. However, the problem becomes more complicated when a path is desired that not only minimizes the hop length but also, among paths with the same hop length, minimizes or approximately minimizes the total length of the path. The solution can be approximated usinggeometric spanners.[22]
Innumber theory, the unsolvedGaussian moat problem asks whether or not minimax paths in theGaussian prime numbers have bounded or unbounded minimax length. That is, does there exist a constantB such that, for every pair of pointsp andq in the infinite Euclidean point set defined by the Gaussian primes, the minimax path in the Gaussian primes betweenp andq has minimax edge length at most B?[23]