Download presentation
Presentation is loading. Please wait.
Published byBruce Thomas Modified over 9 years ago
1
Nick McKeown Spring 2012 Maximum Matching Algorithms EE384x Packet Switch Architectures
2
Network Flows Source s Sink t ac bd 10 1 1 1 Let G = [V,E] be a directed graph with capacity cap(v,w) on edge [v,w]. A flow is an (integer) function, f, that is chosen for each edge so that We wish to maximize the flow allocation.
3
A maximum network flow example By inspection Source s Sink t ac bd 10 1 1 1 Step 1: Source s Sink t ac bd 10, 10 10 10, 10 1 1 1 10 10, 10 Flow is of size 10
4
A maximum network flow example Source s Sink t ac bd 10, 10 10, 1 10, 10 1 1 1, 1 10, 1 10, 10 Step 2: Flow is of size 10+1 = 11 Source s Sink t ac bd 10, 10 10, 2 10, 9 1,1 10, 2 10, 10 Maximum flow: Flow is of size 10+2 = 12 Not obvious
5
Ford-Fulkerson augmenting paths 1.Set f(v,w) = -f(w,v) on all edges. 2.Define a Residual Graph, R, in which res(v,w) = cap(v,w) – f(v,w) 3.Find paths from s to t for which there is positive residue. 4.Increase the flow along the paths to augment them by the minimum residue along the path. 5.Keep augmenting paths until there are no more to augment.
6
Example of Residual Graph st ac bd 10, 10 10 10, 10 1 1 1 10 10, 10 Flow is of size 10 t ac bd 10 1 1 1 s res(v,w) = cap(v,w) – f(v,w) Residual Graph, R Augmenting path
7
Example of Residual Graph st ac bd 10, 10 10, 1 10, 10 1 1 1, 1 10, 1 10, 10 Step 2: Flow is of size 10+1 = 11 st ac bd 10 1 1 1 1 1 Residual Graph 9 9
8
Example of Residual Graph st ac bd 10, 10 10, 2 10, 9 1, 1 10, 2 10, 10 Step 3: Flow is of size 10+2 = 12 st ac bd 10 2 9 1 1 1 2 Residual Graph 8 8 1
9
Complexity of network flow In general, it is possible to find a solution by considering at most |V|.|E| paths, by picking shortest augmenting path first. There are many variations, such as picking most augmenting path first.
10
Finding a maximum size match Q: How do we find the maximum size (weight) match? A B C D E F 1 2 3 4 5 6
11
Network flows and bipartite matching Finding a maximum size bipartite matching is equivalent to solving a network flow problem with capacities and flows of size 1. A1 Source s Sink t B C D E F 2 3 4 5 6
12
Network flows and bipartite matching Ford-Fulkerson method A1 s t B C D E F 2 3 4 5 6 Residual Graph for first three paths:
13
Network flows and bipartite matching A1 s t B C D E F 2 3 4 5 6 Residual Graph for next two paths:
14
Network flows and bipartite matching A1 s t B C D E F 2 3 4 5 6 Residual Graph for augmenting path:
15
Network flows and bipartite matching A1 s t B C D E F 2 3 4 5 6 Residual Graph for last augmenting path: Note that the path augments the match: no input and output is removed from the match during the augmenting step.
16
Network flows and bipartite matching A1 s t B C D E F 2 3 4 5 6 Maximum flow graph:
17
Network flows and bipartite matching A1 B C D E F 2 3 4 5 6 Maximum Size Matching:
18
Complexity of Maximum Matchings Maximum Size Matchings: – Algorithm by Dinic O(N 5/2 ) Maximum Weight Matchings – Algorithm by Kuhn O(N 3 ) In general: – Hard to implement in hardware – Slooooow.
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.