Download presentation
Presentation is loading. Please wait.
1
Lecture 11
2
Matching A set of edges which do not share a vertex is a matching. Application: Wireless Networks may consist of nodes with single radios, no interference constraint A set of links can be scheduled only if the set is a matching
3
Input Queued Switches The links scheduled must be a matching
4
Maximum Matching Matching of largest cardinality Augmenting path is a path of alternating sequence of matched and unmatched edges with free end nodes. A node is free if none of its incident edges is in a matching. e1e1 e2e2 e3e3 Size of matching increases if {e 2 } is replaced by {e 1, e 3 }
5
A B = (A – B) (B – A) Suppose M is a matching and P is an augmenting path. Then M P is also a matching A matching is maximum if and only if there is no augmenting path. Also, |M P | = |M| + 1 If there is no augmenting path, then the matching is not maximum.
6
Let there be a matching M` of greater cardinality than M. Consider the graph M M’ Clearly, a vertex can have at most 2 incident edges So the new graph consists of disjoint paths and cycles. The cycles must be even cycles with alternating edges from M and M’ A vertex can have one incident edge from M, or one incident edge from M’, or one incident edge from M and another from M’
7
Paths will also have edges altering between M and M’ Since M’ has a cardinality greater than M, there must be at least one path which starts and ends in M’. This is an augmenting path for M.
8
Maximum Matching Algorithm Start with an empty set. 1) Search for an augmenting path. If there is an augmenting path, then update the matching, else terminate. Go to (1) How does one find an augmenting path?
9
Bipartite Graph Augmenting path can be found by Hungarian tree method Breadth first search like method Consider one of the two partitions S. S T Start from the free vertices in S All the edges from the free vertices are in the tree.
10
S T Start from the free vertices in S All the edges from the free vertices are in the tree. If we happen to reach a free vertex in T, then we have found an augmenting path. Suppose all the vertices in T are matched, then we follow the matched edges back to S, and subsequently all free edges from the newly encountered ones in S. If we reach a free vertex in T we are done, otherwise again follow back the matched edges into S.
11
We would never reach the same vertices in S anyway. Vertices in S are either matched or free. We take only matched edges to reach S from T. A matched edge can not reach a free vertex. A matched edge can not reach an already reached matched vertex, because it has been reached using a different matched edge. Don’t include free edges from S into already reached vertices in T. So vertices in T are never repeated
12
Hungarian tree search finishes in O(E)
13
Is it possible that there is an augmenting path, but the Hungarian tree does not yield one? An augmenting path has odd length. Any odd length path must have one end in S and another end in T. An augmenting path must have one free vertex in S and another in T. Consider an augmenting path from the free vertex in S.
14
The first edge is from a free vertex in S. The second edge is a matched edge from T. The third edge is a free edge from S. The fourth is a matched edge from T…. We are looking at all such paths in the Hungarian method. If there is an augmenting path, we would find one!
15
Complexity Analysis Once an augmenting path is found, one new vertex is matched. Need to look for augmenting paths at most V times. Looking for an augmenting path consume O(E). So, overall O(VE).
16
Nonbipartite Graph Basic algorithm remains same. Need to find augmenting paths in different ways. We can not partition the vertex set into two sets, and start with free vertices in just one set. As a result need to consider all free vertices. You may clearly reach some free vertex in your search because an augmenting path ends in a free vertex.
17
But reaching a free vertex does not mean that we have reached an augmenting path. So we can not rule out reaching free vertices (as an augmenting path starts and ends in a free vertex). At the same time when we reach a free vertex, we do not know whether we have an augmenting path or not! Odd cycles are the problems.
18
So for nonbipartite graphs, we start from a single free vertex at a time. Also, whenever odd cycles are detected they are shrunk into one vertex, called blossoms. After discovering augmenting paths, the blossoms are expanded. Need an O(V 4 ) algorithm.
19
Weighted Matching Now, every edge has a weight. Weight of a matching is the sum of the weights of its edges. Need to find a maximum weighted matching. More general case of maximum matching (maximum matching is maximum weighted matching with edge weight 1)
20
Is it sufficiently general to consider a graph with nonnegative weights? Is it sufficiently general to consider complete graphs? (A complete graph is one where there is an edge between every pair of vertices). For bipartite graphs, is it sufficient to consider equal size partitions only.
21
Bipartite Graphs Will consider bipartite graphs. Partitions are X and Y and |X| = |Y| We assume that there is always an edge between vertex x in partition X, and vertex y in partition Y. Every edge has a nonnegative weight. A matching where every vertex is matched is a perfect matching. Such a bipartite graph has a perfect matching.
22
Vertex Labeling We assign a nonnegative real number with each vertex. This nonnegative real number is the label of the vertex. Label of vertex x is l(x). A label is feasible if for every edge (x, y), l(x) + l(y) w(x, y) An example of a feasible label is l(y) = 0 for all vertices in Y and l(x) = max y w(x, y) l(x) + l(y) = max y w(x, y) w(x, y)
23
Equality Subgraph Equality subgraph consists of all vertices. An edge (x, y) is included in the equality subgraph if l(x) + l(y) = w(x, y). If the equality subgraph G l has a perfect matching M , then M is the maximum weighted matching in the original graph G. Weight of M = e M w(e) = u, : u, is matched l(u) (since M is a matching and G l is an equality subgraph) = u, : u, is in V l(u) (since M is a perfect matching)
24
Consider any other matching M in the graph G. Weight of M = e M w(e) u, : u, is matched l(u) (since M is matching) u, : u, is in V l(u) (since labels are nonnegative) = Weight of M So, if we can adjust the labels so that the equality subgraph has a perfect matching, then we are done. Why?
25
If a perfect matching exists, then it is the maximum matching. So, existence of a perfect matching can be tested by computing the maximum matching in the equality subgraph. Supposing, the equality subgraph had all the edges in the original graph. Then it is a complete bipartite graph. Hence, it would have a perfect matching.
26
So, if the equality subgraph does not have a perfect matching, we should adjust the labels so that the number of edges in the equality subgraph increases. However, any adjustment should be such that the labels are feasible. Adjustment should aim at satisfying equality constraints in the edges.
27
Maximum Weighted Matching Algorithm Start with the following labels: l(y) = 0 for all vertices in Y and l(x) = max y w(x, y) 2. Construct the equality subgraph. Find a maximum matching in the equality subgraph. If this is a perfect matching, then stop. Otherwise, readjust the labels and go to step (2).
28
Readjustment of Labels Construct the Hungarian tree w.r.t. the current maximum matching in the equality subgraph. Let S be the set of vertices in X in the tree, and T be the set of vertices in Y. Start from the free vertices in X. Free vertices exist since the matching is not perfect. The hungarian tree will not yield an augmenting path in the equality subgraph.
29
Observe that there are no edges between S and Y – T in the equality subgraph (else hungarian tree has not been grown properly). At the same time, there are edges between S and Y – T in the original graph. Reason: Current matching is not maximum in G, as G has a perfect matching, and this is not a perfect matching. So the hungarian tree must have an augmenting path in G. But we know there is no augmenting path in the current hungarian tree. This means that the current hungarian tree can grow further in G, and this is possible only if there are edges between S and Y-T.
30
Decrease the labels in S uniformly, and increase those in T uniformly so that the labels are valid. Edges between S and Y-T in G will now start entering the equality subgraph. Stop when the first edge enters. A new vertex in Y is added to the Hungarian tree. If this vertex is free we have an augmenting path, otherwise the Hungarian tree grows.
31
If this vertex is free, stop the relabelling and go to step (2). Otherwise, relabel once again. Hungarian tree can not grow indefinitely. So we always improve the matching before going to step (2). Now, we improve the matching till we find a perfect matching in the equality subgraph.
Similar presentations
© 2024 SlidePlayer.com. Inc.
All rights reserved.