Network Flow & Linear Programming Jeff Edmonds York University Adapted from NetworkFlow.ppt
Instance: A Network is a directed graph G Edges represent pipes that carry flow Each edge has a maximum capacity c A source node s in which flow arrives A sink node t out which flow leaves Goal: Max Flow Network Flow Adapted from NetworkFlow.ppt
Instance: A Network is a directed graph G Edges represent pipes that carry flow Each edge has a maximum capacity c A source node s in which flow arrives A sink node t out which flow leaves Network Flow Adapted from NetworkFlow.ppt
Solution: The amount of flow F through each edge. Flow can’t exceed capacity i.e. F c. Unidirectional flow F 0 and F = 0 or F = 0 and F 0 Some texts: F = -F Network Flow Adapted from NetworkFlow.ppt
Solution: The amount of flow F through each edge. Flow F can’t exceed capacity c. Unidirectional flow No leaks, no extra flow. Network Flow Adapted from NetworkFlow.ppt
Solution: The amount of flow F through each edge. Flow F cant exceed capacity c. Unidirectional flow No leaks, no extra flow. For each node v: flow in = flow out u F = w F Except for s and t. Network Flow Adapted from NetworkFlow.ppt
Value of Solution: Flow from s into the network minus flow from the network back into s. rate(F) = u F = flow from network into t minus flow back in. = u F - v F - v F What about flow back into s? Goal: Max Flow Network Flow Adapted from NetworkFlow.ppt
Network flow problem is a linear program Taken from
Adapted from NetworkFlow.ppt
A network with its edge capacities Network Flow What is the maximum that can flow from s to t? Adapted from NetworkFlow.ppt
A network with its edge capacities Network Flow The max total rate of the flow is = 3. flow/capacity = 2/5 Can prove that total cannot be higher. Adapted from NetworkFlow.ppt
No more flow can be pushed along the top path because the edge is at capacity. Similarly, the edge. No flow is pushed along the bottom path because this would decrease the total from s to t. Network Flow Adapted from NetworkFlow.ppt
is a minimum cut Its capacity is the sum of the capacities crossing the cut = 1+2 = 3. is not included in because it is going in the wrong direction. Network Flow Adapted from NetworkFlow.ppt
The edges crossing forward across the cut are at capacity those crossing backwards have zero flow. This is always true. Network Flow Adapted from NetworkFlow.ppt
The maximum flow is 1+2=3 The minimum cut is 1+2=3. These are always equal. Maxflow = Mincut Adapted from NetworkFlow.ppt
An Application: Matching SamMary BobBeth JohnSue FredAnn Who loves whom. Who should be matched with whom so as many as possible matched and nobody matched twice? 3 matches Can we do better? 4 matches Adapted from NetworkFlow.ppt
An Application: Matching st c = 1 Total flow out of u flow into u 1 Boy u matched to at most one girl. 1 c = 1 Total flow into v = flow out of v 1 Girl v matched to at most one boy. 1 u v Adapted from NetworkFlow.ppt
Instance: A Network is a directed graph G Special nodes s and t. Edges represent pipes that carry flow Each edge has a maximum capacity c Partition into two regions so that the cut between the two is minimized Min Cut s t Adapted from NetworkFlow.ppt