1 / 24

Preflow Push Algorithm

Preflow Push Algorithm. M. Amber Hassaan. a. 5, 2. 4, 4. s. 6, 2. t. 8, 7. 5, 5. b. Max Flow Problem. Given a graph with “Source” and “Sink” nodes we want to compute: The maximum rate at which fluid can flow from Source to Sink The rate of flow through each edge of the graph

tavi
Download Presentation

Preflow Push Algorithm

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Preflow Push Algorithm M. Amber Hassaan

  2. a 5, 2 4, 4 s 6, 2 t 8, 7 5, 5 b Max Flow Problem • Given a graph with “Source” and “Sink” nodes we want to compute: • The maximum rate at which fluid can flow from Source to Sink • The rate of flow through each edge of the graph • Given a graph: • Edges have flow capacities • First value is flow capacity • Second value is current flow rate • Edges behave like pipes • Nodes are junctions of pipes • History: • Ford and Fulkerson 1956 (Augmenting Paths) • Dinic 1970 • Edmonds and Karp 1972 • Malhotra, Kumar and Maheshwari 1978 • Goldberg and Tarjan 1986 (Preflow Push) • Boykov and Kolmogorov 2006 Min-cut Preflow Push Algorithm

  3. a 5, 2 4, 4 s 6, 2 t 8, 7 5, 5 b Max Flow Problem • Flow f(u,v) is a real-valued function defined for every edge (u,v) in the graph • The flow needs to satisfy the following 3 properties: • f(u,v) ≤ c(u,v) i.e. capacity of edge (u,v) • f(u,v) = - f(v,u) • Flow coming into node v = Flow leaving v Preflow Push Algorithm

  4. a a 2 4 5, 2 4, 4 3 s s 6, 2 4 t t 2 1 8, 7 5, 5 5 7 b b Max Flow Problem • Residual Graph: • A Graph that contains edges that can admit more flow • Define a Graph G(V,E’) for G(V,E) • We define residual flow r(u,v) = c(u,v) – f(u,v) • If r(u,v) > 0 then (u,v) is in E’ Original Graph Residual Graph Preflow Push Algorithm

  5. Preflow Push Algorithm for Maxflow problem • Relaxation algorithm: • Performs local updates repeatedly until global constraint is satisfied • Similar to Stencil computations • Fluid flows from a higher point to a lower point • In the beginning • “Source” is the highest point • “Sink” and all other nodes are at the lowest point • Source sends maximum flow on its outgoing edges • Sending flow to out-neighbors is called “Push” operation • The height of Source’s neighbors is then increased so that fluid can flow out • Increasing height of a node is called “Relabel” operation Preflow Push Algorithm

  6. Preflow Push Algorithm for Maxflow problem • A node is allowed (temporarily) to have more flow coming into it than flow going out • i.e. a node can have “excess flow” • But the edges must respect the capacity condition • Source can have arbitrary amount of excess flow • A node is said to be “active” if it has excess flow in it Preflow Push Algorithm

  7. Preflow Push Algorithm for Maxflow problem • We increase the height of the “active” node with a “Relabel” operation • If h is the minimum height among neighbors that can accept flow • Then height is relabeled to (h+1) • Then we “push” the excess flow to the neighbors • That are lower than the active node and can admit flow • Thus make them active • Algorithm terminates when there are no “active” nodes left Preflow Push Algorithm

  8. h=0 e=0 h=0 e=0 15,0 a b 10,0 3,0 5,0 t s 8,0 h=0 e=0 h=6 17,0 12,0 c d 6,0 h=0 e=0 h=0 e=0 Example • A simple graph: • Nodes have two attributes: • Height ‘h’ • Excess flow ‘e’ • Edges have pairs: • First value is edge capacity • Second value is flow • Initialize: • s has h=6 i.e. number of nodes • Push 10 along (s,a) • e(a) = 10 • Push 12 along (s,c) • e(c) = 12 Preflow Push Algorithm

  9. h=0 e=10 h=0 e=10 15,0 a b 10,10 3,0 5,0 t s 8,0 h=0 e=0 h=6 17,0 12,12 c d 6,0 h=1 e=12 h=0 e=0 Example • Relabel c with h=1 • Push 6 along (c,d) • e(d) = 6 • Relabel c with h=2 • Push 5 along (c,a) • e(a) = 5 • Relabel c with h=7 • Push -1 along (s,c) Preflow Push Algorithm

  10. h=1 e=15 h=0 e=0 15,0 a b 10,10 3,0 5,5 t s 8,0 h=0 e=0 h=6 17,0 12,11 c d 6,6 h=7 e=0 h=0 e=5 Example • Relabel a with h=1 • Push 15 along (a,b) • e(b) = 15 Preflow Push Algorithm

  11. h=1 e=0 h=1 e=15 15,15 a b 10,10 3,0 5,5 t s 8,0 h=0 e=3 h=6 17,0 12,11 c d 6,6 h=7 e=0 h=0 e=6 Example • Relabel b with h=1 • Push 3 along (b,t) • e(t) = 3 • Push 8 along (b,d) • e(d) = 14 • Relabel b with h=2 • Push -4 along (a,b) • e(a) = 4 Preflow Push Algorithm

  12. h=1 e=4 h=2 e=0 15,11 a b 10,10 3,3 5,5 t s 8,8 h=0 e=3 h=6 17,0 12,11 c d 6,6 h=7 e=0 h=1 e=14 Example • Relabel d with h=1 • Push 14 along (d,t) • e(t) = 17 Preflow Push Algorithm

  13. h=3 e=4 h=2 e=0 15,11 a b 10,10 3,3 5,5 t s 8,8 h=0 e=17 h=6 17,14 12,11 c d 6,6 h=7 e=0 h=1 e=0 Example • Relabel a with h=3 • Push 4 along (a,b) • e(b) = 4 Preflow Push Algorithm

  14. h=3 e=0 h=4 e=4 15,15 a b 10,10 3,3 5,5 t s 8,8 h=0 e=17 h=6 17,14 12,11 c d 6,6 h=7 e=0 h=1 e=0 Example • Relabel b with h=4 • Push -4 along (a,b) • e(a) = 4 Preflow Push Algorithm

  15. h=5 e=4 h=4 e=0 15,11 a b 10,10 3,3 5,5 t s 8,8 h=0 e=17 h=6 17,14 12,11 c d 6,6 h=7 e=0 h=1 e=0 Example • Relabel a with h=5 • Push 4 along (a,b) • e(b) = 4 Preflow Push Algorithm

  16. h=5 e=0 h=6 e=4 15,15 a b 10,10 3,3 5,5 t s 8,8 h=0 e=17 h=6 17,14 12,11 c d 6,6 h=7 e=0 h=1 e=0 Example • Relabel b with h=6 • Push -4 along (a,b) • e(a) = 4 Preflow Push Algorithm

  17. h=7 e=4 h=6 e=0 15,11 a b 10,10 3,3 5,5 t s 8,8 h=0 e=17 h=6 17,14 12,11 c d 6,6 h=7 e=0 h=1 e=0 Example • Relabel a with h=7 • Push -4 along (s,a) • e(a) = 0 Preflow Push Algorithm

  18. h=7 e=0 h=6 e=0 15,11 a b 10,6 3,3 5,5 t s 8,8 h=0 e=17 h=6 17,14 12,11 c d 6,6 h=7 e=0 h=1 e=0 Example • No active nodes left • The algorithm terminates Min-cut Preflow Push Algorithm

  19. Pseudo code • Worklist wl = initializePreflowPush(); • while (!wl.isEmpty()) { • Node n = wl.remove(); • n.relabel(); • for (Node w in n.neighbors()) { • if (n can push flow to w) { • pushflow(n, w); • wl.add(w); • } • } • if (n has excess flow) { • wl.add(n); • } • } Preflow Push Algorithm

  20. Amorphous Data Parallelism in Preflow Push • Topology: graph • Operator: local computation (data driven) • Active nodes: nodes with excess flow • Neighborhoods: active nodes and their neighbors • Ordering: unordered • Parallelism: Shoots in the beginning and then drops down • Dependent on number of active nodes Preflow Push Algorithm

  21. Parallelism profile for Preflow Push Input Graph: 512x512 Grid Preflow Push Algorithm

  22. Preflow Push: Global Relabeling • The height of the nodes directs the flow towards the sink: • It affects the flow of fluid globally • But is updated locally • Which causes the fluid to flow in arbitrary directions • Increases the total number of push/relabel operations • Global Relabeling: • After every N push/relabel operations we compute the height of every node from the sink • The height is computed by a breadth-first scan on the Residual Graph • starting at the sink • The height is incremented at each next level of BFS • It reduces the number of push/relabel operations significantly • N is determined heuristically Preflow Push Algorithm

  23. Preflow Push: Global Relabeling h=2 e=0 h=1 e=0 4 a b 4 11 3 6 5 t s 8 14 h=0 e=17 h=6 11 1 3 c d 6 h=2 e=0 h=1 e=0 Preflow Push Algorithm

  24. Conclusion • Preflow Push is an algorithm to find the max-flow in a graph • It exhibits amorphous data parallelism • Parallelism is dependent on the structure of the graph Preflow Push Algorithm

More Related