Maximum Flow Neil Tang 3302010 CS 223 Advanced

  • Slides: 17
Download presentation
Maximum Flow Neil Tang 3/30/2010 CS 223 Advanced Data Structures and Algorithms 1

Maximum Flow Neil Tang 3/30/2010 CS 223 Advanced Data Structures and Algorithms 1

Class Overview Ø Ø Ø Ø The maximum flow problem Applications A greedy algorithm

Class Overview Ø Ø Ø Ø The maximum flow problem Applications A greedy algorithm which does not work The Ford-Fulkerson algorithm Implementation and time complexity Another approach: linear programming An Application: maximum matching in a bipartite graph CS 223 Advanced Data Structures and Algorithms 2

The Maximum Flow Problem Ø The weight of a link (a. k. a link

The Maximum Flow Problem Ø The weight of a link (a. k. a link capacity) indicates the maximum amount of flow allowed to pass through this link. Ø The maximum flow problem: Given a weighted directed graph G, a source node s and a sink node t, find the maximum amount of flow that can pass from s to t and a corresponding feasible link flow allocation. Ø Flow feasibility: Both the flow conservation constraint and the capacity constraint must be satisfied. CS 223 Advanced Data Structures and Algorithms 3

The Maximum Flow Problem CS 223 Advanced Data Structures and Algorithms 4

The Maximum Flow Problem CS 223 Advanced Data Structures and Algorithms 4

Applications Ø Computer networks: Data traffic routing for throughput maximization. Ø Transportation networks: Road

Applications Ø Computer networks: Data traffic routing for throughput maximization. Ø Transportation networks: Road construction and traffic management. Ø Graph theory: Matching, assignment problems. CS 223 Advanced Data Structures and Algorithms 5

Flow Graph and Residual Graph CS 223 Advanced Data Structures and Algorithms 6

Flow Graph and Residual Graph CS 223 Advanced Data Structures and Algorithms 6

Basic Idea Ø Keep finding s-t augmenting paths until no such paths can be

Basic Idea Ø Keep finding s-t augmenting paths until no such paths can be found in the residual graph. Ø Update the flow and residual graph according to the augmenting path in each step. CS 223 Advanced Data Structures and Algorithms 7

A Greedy Algorithm which Does Not Work Find an augmenting path s-a-d-t with flow

A Greedy Algorithm which Does Not Work Find an augmenting path s-a-d-t with flow value 3 and update the flow and residual graphs as follows: CS 223 Advanced Data Structures and Algorithms 8

The Ford-Fulkerson Algorithm Find an augmenting path s-a-d-t with flow value 3 and update

The Ford-Fulkerson Algorithm Find an augmenting path s-a-d-t with flow value 3 and update the flow and residual graphs as follows: CS 223 Advanced Data Structures and Algorithms 9

The Ford-Fulkerson Algorithm Find an augmenting path s-b-d-a-c-t with flow value 2 and update

The Ford-Fulkerson Algorithm Find an augmenting path s-b-d-a-c-t with flow value 2 and update the flow and residual graphs as follows: CS 223 Advanced Data Structures and Algorithms 10

The Implementation and Time Complexity Ø If all the link capacities are integers, then

The Implementation and Time Complexity Ø If all the link capacities are integers, then the time complexity of the Ford-Fulkerson algorithm is bounded by O(f|E|), where f is the max flow. Ø A bad example for random path selection. CS 223 Advanced Data Structures and Algorithms 11

The Implementation and Time Complexity Ø In each step, find an augmenting path which

The Implementation and Time Complexity Ø In each step, find an augmenting path which allows largest the increase in flow using a modified Dijkstra’s algorithm. It has been proved that it terminates after O(|E|log. Capmax) steps, so the time complexity is O(|E|2 log|V|log. Capmax). Ø The Edmonds-Karp algorithm: In each step, find an augmenting path with minimum number of edges using BFS. It has been proved that it terminates after O(|E||V|) steps. So the time complexity is O(|E|2|V|). CS 223 Advanced Data Structures and Algorithms 12

Another Approach: Linear Programming LP in the standard form An LP can be solved

Another Approach: Linear Programming LP in the standard form An LP can be solved by existing algorithms in polynomial time. CS 223 Advanced Data Structures and Algorithms 13

Maximum Flow Problem - LP CS 223 Advanced Data Structures and Algorithms 14

Maximum Flow Problem - LP CS 223 Advanced Data Structures and Algorithms 14

Shortest Path Problem - ILP CS 223 Advanced Data Structures and Algorithms 15

Shortest Path Problem - ILP CS 223 Advanced Data Structures and Algorithms 15

Maximum Matching in A Bipartite Graph A matching (a. k. a. independent edge set):

Maximum Matching in A Bipartite Graph A matching (a. k. a. independent edge set): a set of edges without common vertices. The maximum matching problem: find the matching with the maximum number of edges. CS 223 Advanced Data Structures and Algorithms 16

Maximum Matching in A Bipartite Graph A max-flow based algorithm CS 223 Advanced Data

Maximum Matching in A Bipartite Graph A max-flow based algorithm CS 223 Advanced Data Structures and Algorithms 17