maxFlow-scaling - hmgto Unheuts mSt 101115 Engineering Max...

Info iconThis preview shows pages 1–15. Sign up to view the full content.

View Full Document Right Arrow Icon
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Background image of page 2
Background image of page 3

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Background image of page 4
Background image of page 5

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Background image of page 6
Background image of page 7

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Background image of page 8
Background image of page 9

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Background image of page 10
Background image of page 11

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Background image of page 12
Background image of page 13

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Background image of page 14
Background image of page 15
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: hmgto Unheuts mSt 101115 Engineering Max Flow Problem — Scaling Jon Turner Computer Science & Engineering Washington University www.ar1.wustl.edu/~jst ~3- Washmgton UniverSItymStlouis Engineering Maximum Capacity Augmentation .Select augmenting paths with max residual capacity >> requires solution of bottleneck shortest path problem lLemma 8.2. Let fbe a flow and f* a max flow on G. If R is res. graph for f, max flow on R has value |f*|-|f| proof. For any flow f’on R, the function f+f’ is a flow on G with value |f|+|f’|, which implies |f’|s|f*|-|f|. Similarly, the function f*—f is a flow on R of value |f*|—|f| and is thus a max flow on R. l - Theorem 8.3. Max cap augmentation produces series of flow values that converge to a max flow; if capacities are integers, it completes in 0(m log C) steps where C is the max edge capacity Proof. Divide execution into phases; if first path of a phase has capacity c, then next phase begins with first step in which the path capacity is sC/Z (note that path capacities may increase) 2 $Msh1ngton UnwersuymStlouls Engineering Let f be flow at start of phase, let f* be a max flow and let f’ be a max flow on the residual graph R for f >> by the proof of Lemma 8.3, f’ can be decomposed into Sm augmenting paths, so there is an augmenting path in R with capacity at least |f’|/m=(|f*|-|f|)/m >> suppose phase lasts for r>2m steps; by definition of phase, each path selected in phase has capacity >(|f*|—|f|)/2m >> this implies total capacity of all r paths exceeds |f*|—|f| so must have, rs2m Since max capacity is initially c and is at least 1 until a max flow is found, total # of steps is O(m log c) I l Running time of O(mT log C) if capacities are integers and T is time to solve bottleneck path problem >> can use variant of Dijkstra’s algorithm with Fibonacci heaps e- Mshlngton UnlverSItymStlouls Engineering Implementing Max Capacity Augmentation bool findpath() { // Find a path with unused residual capacity vertex u, v; edge e; Dheap nodeHeap(fg->n(),4); int bcap[fg->n()+1]; for (u l; u <= fg—>n(); u++) ( pEdge[u] = 0; bcap[u] = 0; } bcaplfg->src()] = BIGINT; nodeHeap.insert(fg->src(),-BIGINT); // negative, so deletemin // gives max cap while (!nodeHeap.empty()) { u = nodeHeap.deletemin(); for (e = fg—>firstAt(u); e != 0; e fg—>nextAt(u,e)) { v = fg—>mate(u,e); if (min(bcap[u], fg->res(u,e)) > bcap[v]) { bcap[v] = min(bcap[u],fg->res(u,e)); pEdge[v] = e; if (nodeHeap.member(v)) nodeHeap.changekey(v,—bcap[v]); else nodefieap.insert(v,-bcap[v]); ) } return pEdge[fg->snk()] != 0; @- Mshmgton UniverSImetloms Engineering Review Questions 1. Let p1,p2,...,p, be the sequence of augmenting paths selected by the max capacity, augmenting path algorithm. Give an example of a graph for which there is some path p,- in the sequence for which the capacity of p,- is larger than the capacity of pi-l‘ . On slide 3, the first bullet point argues that because the number of augmenting paths is bounded by m, some augmenting path must have capacity |f’|/m. But we know that max capacity augmentation need not select paths in decreasing order of their capacity; indeed, the largest capacity path in the sequence found by the algorithm may not be available at the first step. So, can we really say that max capacity augmentation will pick a path of capacity |f’|/m? Explain the flaw in this “counter-argument”. . What is the overall running time of the max capacity augmenting path algorithm, using the implementation on slide 4? How does it change if use a Fibonacci heap instead of a d-heap? ~3- Washmgton UnwersuymStlouls Engineering Capacity Scaling Algorithm - Capacity-scaling searches for large capacity paths but not max capacity paths >> searches restricted to edges with residual capacity that exceed a scaling factor A >> so all paths found increase flow by A >> this allows use of breadth-first search in place of Dijkstra IStart by letting A=C where C is max edge capacity; repeat following step until A<1 >> find a shortest augmenting path in the subgraph RA, of the residual graph R, containing edges with residual capacity 2A >> add as much flow as possible to the path >> if there is no augmenting path, replace A by A/2 ~3- Washmgton UniverSItymStlouis Engineering Analysis of Capacity Scaling - Number of steps between successive changes to A is at most 2m; to see this, divide execution into phases — new phase starts whenever A is reduced >> consider situation at start of a phase with scaling factor A >> let X be vertex set reachable from s by paths with residual capacity 22A; every edge crossing cut (X,X’) has residual capacity <2A; so, total capacity of edges crossing cut is <2Am >> each step in current phase increases the net flow crossing the cut by at least A (note: augmenting path may cross cut more than once), so after 2m steps, residual capacity of edges crossing cut would be zero; so phase must terminate after at most 2m steps. I Using breadth—first search in R to find paths, running time is O(m2 log C), for integer edge capacities >> so, better than shortest path augmentation if log C<n ~3- Mshmgton UnlverSItymStlouls Engineering Implementing Capacity Scaling bool augPath::findPath() ( vertex u,v; edge e; list queue(G->n()); while (D > 0) { for (u = 1; u <= G->n(); u++) pEdge[u] = Null; queue &= G->src(); while (!queue.empty()) ( u = queue[1]; queue <<= 1; for (e = G->first(u); e != G->term(u); e=G->next(u,e)) { v = G—>mate(u,e); if (G—>res(u,e) >= D && pEdge[v] == Null && v != G->src()) { pEdge[v] = e; if (v == G—>snk()) return true; queue &= v; } } D /= 2; ) return false; @- Mshmgton UnwersuymStloms Engineering Experimental Comparison 7,000 6,000 shortPath 5,000 * shortPath 4,000 3,000 2,000 1,000 a U] n. E.’ III 0! C '5 C a) E m 3 m ._ O 4* # of augmenting steps 0 25 50 75 100 125 150 175 200 225 250 . 7,5 10 12,5 15 17.5 20 22.5 25 (# of edges)/1000 (max capacity/10%) uResults for random graphs -# of augmenting steps within 2x of each other I # of steps grows far more slowly than # of edges uNo significant dependence on edge capacity — Engineering Preflow-Push, Max Excess E Washington University in St. Louis I Let Af (u) be excess at node u and let AfmaX be the largest excess at any time lAt each step, select u with Af(u)=Afmax and attempt to push flow along admissible edges until u is balanced or must be relabeled >> limit the amount of flow added to each edge to ensure that Afmax never increases >> between relabelings at u, there is at most 1 time when we add flow to edge (u,v) without saturating it or balancing u 0 so, time spent on such steps is 0(mn) >> remains to bound number of times we add flow to an edge without saturating it and make u balanced — 0(n2|og C) 10 In $Msh1ngton UnwersuymStlouis Engineering Analysis uDivide execution into phases >> Let E be max excess at the start of a phase >> next phase starts the first time that the vertex with the largest excess has an excess SE/Z >> note that initially ESC and during last phase E21, so number of phases is O(log C) 0 so, it is sufficient to show that number of steps in each phase that add flow to an edge (u,v) and make u balanced is O(nz) uLemma. During each phase, the number of steps that add flow to an edge (u,v) without saturating it and that make u balanced is O(nz). >> so, running time is O((mn + n2|og C)log n), where log n factor accounts for required heap operations II ‘vWashmgton Unwersuy mStlQUb Engineering proof. Let E be the max excess at the start of the phase. Define a potential function P=2,, d(u)Af(u)/E. Note that Af (u)SE for all u, so P<2n2 at the start of the phase. Each time the algorithm selects a new vertex u, it attempts to push flow forward along admissible edges until either the u becomes balanced or it must be relabled. o if we end by relabeling u, the potential may increase, due to the increase in d(u); since Af(u)SE, the increase in potential is bounded by the increase in d(u); consequently, the total increase from all such steps within a phase is <2n2. - if we end by balancing u, then the sequence of steps adding flow to u’s admissible edges reduces the excess at u by >E/2; it also increases the excess at the other endpoints of u’s admissible edges, but since these vertices have smaller labels, the net effect is to decrease the potential function by at least 1/2. Consequently, the number of times we add flow to an edge (u,v) without saturating it, and make u balanced is <8n2. I 1’) — Engineering Preflow-Push Excess Scaling E \X/ashington University in St. Louis IThe excess scaling algorithm selects vertices that have a large (but not necessarily maximum) excess flow Af >> specifically, it defines a scale factor A, and always selects the next unbalanced vertices from those with an excess zA/Z >> when there are no more vertices with excess 2A/2, it halves A >> when there is more than one unbalanced vertex with excess 2A/ 2, a vertex with smallest distance label is chosen >> the algorithm does not allow excess at any vertex to exceed A ICan be analyzed using variant of the argument used for the max excess algorithm I Does not require heap operations, leading to running time of O(mn + n2|og C) I? Washington University in St. Louis Exercises 1. Describe (in words) an algorithm for finding k edge- disjoint paths joining a given pair of vertices in a directed graph. (A set of paths is edge-disjoint if no edge appears in both paths). Lets and t be the given pair ofvertices. Treat the graph as aflow network with all edges having capacity 1. Nowfind a maximmnflow in the graphfrom s to t. Ifthe capacity of theflow is k or more then the graph has k edge-disjoint pat/Isfrom s to tand we can extract themfrom the maximumflow. This can be done by removing all edges with zeroflow and thenfinding pathsfrom s to t and removing the path edges from the graph. How would you implement this algorithm to get the best possible running time? What is the resulting time complexity. We can solve theflow problem in O(m-’) time using the capacity scaling algorithm since all edges have the same capacity, so there is just a single phase. The extraction of paths takes O(m) time since any path in the graph ofedges with positiveflow must terminate at t, by the_flow conservation property. 50 the overall running time is O ("13). — Engineering . How would you modify your algorithm in the last problem to find a set of k vertex-disjoint paths (a set of paths is vertex-disjoint if no vertex appears on more than one path — excepting the initial and final vertices in the path). We can use the same approach tofind vertex-disjoint paths. Wefirst must create a new graph having vertices 11,, uzfor each vertex n in the original graph. For each pair 111, u_,, we include an edge (u,,u:) andfor each edge (u,v) in the original graph, we add an edge (11;, v,) in the new graph. Now, apply the previous algorithm tofind k edge disjoint paths in the new graphfi‘om s: to t,. The resulting path set corresponds directly to a set afk vertex-disjoint paths in the original graph. 3. Show that if g is a flow function on the residual graph for flow fthen h=f+g is a flow function on the original graph. The requirementsfor aflowfimction are that it cansenres flow, is skew symmetric and respects the capacity constraints. I tfollows directlyfrom the definitions of flow conservation and skew symmetry that iffand g are flowfunctions, thatf+g is also. It remains to Show thatf +g obeys the capacity constraint. Since g is defined on the residual graph of R, theflow g(u,v) is bounded by the residual capacity of (u,v) inf, sof(u,v)+g(n,v) can he no larger than the original capacity of (u,v). 14 1/! Washington University in St. Louis — Engineering 4. The figure below shows an instance of the max flow 5_ The figure below shows an instance of the max flow problem, followed by a residual graph for the augmenting path algorithm at an intermediate stage in the computation. Identify the next path that would be selected using max capacity augmentation and show the residual graph obtained when this path is saturated __ 3 1::El GEE ‘2 1 ’ 2\ 4—3—T> Rt’SlllHtlflg 5 1\62 Graph The path selected by shortest path augmentation is s,d,g,c,e,h,f,t which has capacity 2. problem and a residual graph obtained by running the capacity scaling algorithm for two phases (A=16 and A=8). Show the residual graph that is obtained at the end of the next scaling phase (A=4). The new residual graph is m * CW 4/ figs b\ _1_. 9 /® .3 :8 A)<5@_;\85 12 I: ...
View Full Document

This note was uploaded on 03/08/2012 for the course CSE 542 taught by Professor Jonturner during the Spring '12 term at Washington State University .

Page1 / 15

maxFlow-scaling - hmgto Unheuts mSt 101115 Engineering Max...

This preview shows document pages 1 - 15. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online