Q. Maximum Flow Problem. Given a Directed Graph whose edges are labeled with flow capacity, what is the maximum flow that can be pushed from vertex to ?
Q. Minimum Cut Problem. Given a Directed Graph whose edges are labeled with flow capacity, and a source and target vertex , how do you partition the graph into such that the flow capacity from is minimized?
⇒ The two questions give the same answer. i.e…
- the flow rate between is the maximum flow rate of the graph
- For the edges cut by the min-cut…
- all forward edges operate at full capacity. (The sum of forward edges is the maximum flow capacity of the whole graph.)
- all backward edges operate at zero capacity
alg. Ford-Fulkerson Flow Maximization. (FFF-Max) Worked Example
- Idea: Choose some suboptimal flow, then increamentally find a better solution.
- Choose some suboptimal flow through the graph.
- Construct a residual network.
- For edges who have residual capacity, keep those edges but labeled with that residual capacity.
- For every edge, construct a reversed edge with the used capacity (this is useful later)
- If there is still a path from in the residual network, then more flow can be pushed.
- This path is called the ”flow augmenting path”
- The minimum capacity of any edge in the augmenting path is the ”bottleneck” of the path.
- ! Choice of the augmenting path is important. Discussed below.
- Rewire the original graph so that…
- forward edges have their flow decreased by the bottleneck amount
- backward edges—decrease flow of the forward edge represented by that backward edge by that bottleneck in the original graph
- Repeat calculation until there is no path in the residual graph.
alg. Minimum Cut. How to remove the minimum number of edges such that there is no flow from source to sync ?
- Run the Flow Maximization algorithm
- Construct a residual graph of the final max-flow graph.
- From the source vertex, perform a search (DFS/BFS) and mark all reachable edges.
- ⇒ The edges between reachable and unreachable verticies is the min-cut edges.
- Value of a cut is the sum of forward edges (=edges in the direction reachable → unreachable)
- In case of a min-cut one needs to minimize this value
- Value of Min-cut is equal to the maximum flow thru the graph
- (⇒) Given a min cut and its value , maximum flow thru is because backward edges (15 is graph above) is
- A min-cut may not be unique
- To find all of them, residual → run reachability → traverse cut edges to the nodes (may be multiple!)→ run reachability
alg. Choice of Augmenting Path. There are three common options:
- ! Assumptions:
- All capacities are integers
- is the ideal flow rate
- Naive Method
- Finding any path using BFS takes time (fully connected graph)
- Iteration count:
- Total:
- Augmenting path with largest bottleneck.
- Can use modified Shortest Path algorithm with time complexity
- Iteration count:
- Total:
- BFS shortest augmenting path (Edmond-Karp)
- Takes
- Iteration count:
- Total:
- State of the art: , and even
Discussion
Formalization
- the answer is given as a flow function .
- i.e. “assign each edge a flow value”
- all vertices except the source and target vertices must have net zero divergence (=net zero inflow/outflow)
- i.e. “the water can’t disappear or appear randomly in any vertex.”
Applied Problems
k
things with a separate set ofl
things, suspect flow/cut problem.
Q. Edge Matching Problem. (=Maximum Cardinality Matching) Given an undirected, partitioned graph, return the maximum number of edges that don’t share a vertex
- Idea: reduce to a max-flow problem.
- algorithm:
- For a graph partitioned , make all edges directed.
- Construct start and end node , and construct ,
- Calculate the max-flow from
- The edges that are used in the max-flow problem is the solution.
- Complexity:
Q. Advertiser and Viewer Demographic Matching Problem
Q.