Presentation is loading. Please wait.

Presentation is loading. Please wait.

Finding a Path With Largest Smallest Edge

Similar presentations


Presentation on theme: "Finding a Path With Largest Smallest Edge"— Presentation transcript:

1 Finding a Path With Largest Smallest Edge
Nassim Nasser

2 Network Flow – Hill Climbing (Rev.)
Input: Directed graph with special nodes S and T and capacities on edges Output: Max legal flow Construct augmenting graph 1 2 S T 1 1 0/1 0/2 S T Find the edge in the path from S to T whose augmentation capacity is min. Increase flow by Cmin = 1.

3 Benefit of Hill Climbing
Can decrease a flow in one edge while increasing the total flow. Never get stuck in local maxima.

4 Problem With the Hill Climbing Algorithm
Takes very small steps running time could be exponential.

5 How To Fix It? One solution:
Ascent hill climbing algorithm: At each level take the biggest step possible (i.e. Increase the flow by the maximum possible amount). Find an Edge with Largest Smallest weight

6 Find a Path With Largest Smallest Edge Weight
10 6 5 1 S T 12 4

7 Finding the Path With Largest Smallest Edge Weight
Input (instance): a directed weighted graph with special nodes S and T. Output: the path with largest smallest edge.

8 Easier Problem Input: a directed weighted graph and and a weight Wmin.
Output: a path from S to T such that all weights in the path are greater or equal to Wmin if such a path exists. Return no path found otherwise.

9 Solution to the Easier Problem
Graph G and Wmin = 5 5 2 1 9 6 8 S T Remove edges with weight < Wmin 5 6 8 T S 1.48, 11.01 5.72, 8.05 Return any path from S to T or state that no path was found.

10 Back to Initial Problem Find a Path With Smallest Largest Edge Weight
Know how to find a path with all weights >= Wmin How to solve our problem (finding a path with largest smallest edge) ?

11 Use Easier Problem to Solve the Original Problem
Sort edge weights in non-increasing order Iterate through the sorted list, each time try to find a path from S to T where Wmin = Wi Exit when T is reached from S Don’t waste time, reuse work Loop Invariant: The work of previous Wmin has been done and is stored in a useful way. Store G’ Mark reachable nodes from S

12 Find a Path With Largest Smallest Edge Weight
Input: Algorithm: L  Sorted list of weights L  {17,16,14,13,12,11,9,8,6,5} 11 5 17 12 13 9 16 7 8 14 6 S T Construct G’, Reuse work 12 T S G’ = 11 17 9 16 14 13

13 Largest Smallest Weight Algorithm
L is sorted list of edge weights, G’ is a graph with no edge S is marked reachable in G’. Exit T is reached measure progress At each step an edge <u, v> is added to G’. Every node reachable from S in G’, is marked reachable. If the new edge that is added is between two non-reachable vertices. If its start point is a non-reachable vertex and its endpoint is a reachable one. If its start point is a reachable vertex and its endpoint is a non-reachable one.

14 The Algorithm Works! Claim: There is no path from S to T having a larger smallest weight. Prove: Assume at the ith iteration the exit condition is met (T is reached). T was not reachable before when only the edges with larger weights were added. So Wi is the smallest weight within the path from S to T and also it is larger than the remaining weights (i.e. Wi+1 to Wn ). This proves our claim.

15 Running Time DFS for each vertex but reuse work  No vertex is reached more than once (no node is marked reachable more than once) and no edge is visited more than once. The running time for this search O(m) where m is the number of edges. Running time for sorting the weights requires O(mlogm). From 1 & 2  Running time is dominated by the time required for sorting and it is O(mlogm), where m is the number of edges.

16 Steepest Ascent Take the biggest possible steps
How many steps should be taken? (i.e. How many times the network flow algorithm must augment the flow when augmented flow is as large as possible)

17 Steepest Ascent Decreasing Remaining Distance By a Constant Factor
Flow starts from 0 and may need to increased to O(m.2l), where m is the # edges with l bit capacities, Want number of steps (iterations) linear in l. Ri = remaining amount that flow must be increased by after the ith iteration Ri = ratemax – rate(f) Show that Wmin is at least some constant factor of Ri Max Rate of Flow Current Rate of Flow

18 Steepest Ascent Bounding the Remaining Distance
Don’t know ratemax . Ok, doesn’t matter! Can we bound Ri? Upper bound to Ri is the sum of the augmentation capacities of the edges across any cut C = <u, v> in the augmentation graph Ri = ratemax – rate(f)


Download ppt "Finding a Path With Largest Smallest Edge"

Similar presentations


Ads by Google