# Shortest path problem has been reduced to the minimum

• Notes
• awsumst
• 35

This preview shows page 20 - 24 out of 35 pages.

shortest path problem has been reduced to the minimum cost flow problem, and hence theorems that we prove about minimum cost flows will translate to shortest paths.
20
All the flow conservation constraints can be written concisely as Ax = - d where the matrix A has N rows (one for each node in the graph) and M columns (one for each edge in the graph). The entry in the row correspond- ing to node p and edge ( v, w ) is 1 if p = v , is -1 if p = w , and is 0 otherwise. This matrix is known as the Incidence matrix , and can be computed using a formula in Excel if the list of edges is given. The Excel spreadsheets shortestold.xls and shortest.xls illustrate how to set up the min-cost flow problem using the example in figure 1. The first of these solves the problem exactly as specified, with capacities 1. The second sheet solves the same problem but the model ignores the capacity constraints (i.e., sets capacities to ) and also illustrates how the matrix A can be generated automatically. Example 7.4 The maximum compatibility matching problem (section 3) can also be modeled as a minimum cost flow problem by making a graph with N men and N women. We draw an edge from each woman w to each man m with cost equal to the negative of the compatibility, and capacity either 1 or . Set the demand of all women to be - 1 and that for all men to be +1 . 7.3 Basic feasible solutions of min cost flows The following theorem is very useful: Theorem 7.5 If a minimum cost flow problem has integer demands and capacities, then any basic feasible solution must have integer flow on each edge. The proof is a simple cycle canceling technique. Details are in the proof of VRM 5.2.1 and rather than repeating the details, we will present an example of this technique here. Consider the shortest path example we have already seen but with a slight modification as described in figure 2: the cost of the edge ( p, t ) has been reduced to 3 so that the top path ( s, p, t ) and the bottom path ( s, q, r, t ) are equally expensive. Now consider the solution which sends flow 0.5 on the top path and 0.5 on the bottom (figure 3). This is an optimum solution (and in fact if you uncheck the “assume linear model” option, this is the solution you will get in the current version of Excel.). Pick any edge with fractional flow in this solution, say the edge ( s, p ). The first endpoint of this edge is s . Write the node s and the edge ( s, p ) in a table. 21
4 3 2 3 4 2 1 s t p q r Figure 2: The shortest path example modified to have two possible shortest paths. 0.5 0 0 s t p q r 0.5 0.5 0.5 0.5 Figure 3: A fractional optimum solution for the modified shortest path example.The numbers on the edges are flows. 22
Nodes Edges s ( s, p ) Consider the conservation constraint for node p , the other endpoint of edge ( s, p ): x p,s + x p,t - x s,p = 0 . The flow on x s,p is fractional but the RHS of the above equation is integral (in this case, 0), and hence there must be another edge with fractional flow incident on p (i.e. with p as an endpoint). Indeed, there is such an edge, in particular, edge ( p, t ). Add p and ( p, t ) to the table: Nodes Edges s ( s, p ) p ( p, t ) Consider the conservation constraint for t , the other endpoint of ( p, t ): - x r,t - x p,t = - 1 .