assignments and matchings chapter 12 presented by yorai geffen
TRANSCRIPT
![Page 1: Assignments and matchings Chapter 12 Presented by Yorai Geffen](https://reader036.vdocuments.mx/reader036/viewer/2022062322/5697bfec1a28abf838cb87b9/html5/thumbnails/1.jpg)
Assignments and matchings
Chapter 12Presented by Yorai Geffen
![Page 2: Assignments and matchings Chapter 12 Presented by Yorai Geffen](https://reader036.vdocuments.mx/reader036/viewer/2022062322/5697bfec1a28abf838cb87b9/html5/thumbnails/2.jpg)
Overview
• Definitions• Bipartite ( צדדי cardinality matching problem (דו• Bipartite weighted matching problem• Stable Marriage Problem• Nonbipartite cardinality matching problem• Bipartite Matching Algorithm• Nonbipartite Matching Algorithm• Summary
![Page 3: Assignments and matchings Chapter 12 Presented by Yorai Geffen](https://reader036.vdocuments.mx/reader036/viewer/2022062322/5697bfec1a28abf838cb87b9/html5/thumbnails/3.jpg)
Definitions
• Matching: Subgraph with the property that every node in the subgraph has degree zero or one.
• Simple Network: Every node in the network, except the source (s) and sink (t) nodes, has at most one incoming arc or at most one outgoing arc.
![Page 4: Assignments and matchings Chapter 12 Presented by Yorai Geffen](https://reader036.vdocuments.mx/reader036/viewer/2022062322/5697bfec1a28abf838cb87b9/html5/thumbnails/4.jpg)
Bipartite cardinality matching problem
• Bipartite matching problem: Given undirected graph . Our target to find a matching with maximum edges.
• We transform it to a maximum flow problem
![Page 5: Assignments and matchings Chapter 12 Presented by Yorai Geffen](https://reader036.vdocuments.mx/reader036/viewer/2022062322/5697bfec1a28abf838cb87b9/html5/thumbnails/5.jpg)
Transformation to max flow problem
1. Direction: Pointing nodes in to nodes in 2. New nodes: 3. New edges: points to all nodes in and all
nodes in points to 4. Capacity: Each arc in the network 5. Simple network: One incoming arc to , one
outgoing arc from
![Page 6: Assignments and matchings Chapter 12 Presented by Yorai Geffen](https://reader036.vdocuments.mx/reader036/viewer/2022062322/5697bfec1a28abf838cb87b9/html5/thumbnails/6.jpg)
Solution and time complexity
• Matching of cardinality k in = flow of value k in
• Proof on board…• The unit capacity maximum flow algorithm
establishes a maximum flow in unit capacity simple networks in time. [Chapter 8, Theorem 8.2, page 254]
![Page 7: Assignments and matchings Chapter 12 Presented by Yorai Geffen](https://reader036.vdocuments.mx/reader036/viewer/2022062322/5697bfec1a28abf838cb87b9/html5/thumbnails/7.jpg)
Bipartite weighted matching problem
• Bipartite network , with • Arc weights • If directed, require • If undirected, make it directed from to
AKA The Assignment Problem
![Page 8: Assignments and matchings Chapter 12 Presented by Yorai Geffen](https://reader036.vdocuments.mx/reader036/viewer/2022062322/5697bfec1a28abf838cb87b9/html5/thumbnails/8.jpg)
Transformation to min cost flow
• Objective function:
• Possible solutions: Successive Shortest Path Algorithm, Hungarian Algorithm, Relaxation Algorithm, Cost Scaling Algorithm
![Page 9: Assignments and matchings Chapter 12 Presented by Yorai Geffen](https://reader036.vdocuments.mx/reader036/viewer/2022062322/5697bfec1a28abf838cb87b9/html5/thumbnails/9.jpg)
Successive Shortest Path Algorithm
• Reminder: Augments shortest paths from a node with excess supply to a node with unfulfilled demand.
• Time: where is the upper bound of the supply, and denotes the time needed to solve a shortest path problem with nonnegative arc costs bounded by .
• Applied on the matching problem, each iteration augments 1 unit of flow assigning to one node in
![Page 10: Assignments and matchings Chapter 12 Presented by Yorai Geffen](https://reader036.vdocuments.mx/reader036/viewer/2022062322/5697bfec1a28abf838cb87b9/html5/thumbnails/10.jpg)
Relaxation Algorithm
• Relaxed constraints: Allows any node in to be assigned multiple times.1. Assign to with min cost 2. In each iteration, choose over-assigned node in run
shortest path in residual network, update potentials and augment path to an unassigned node .
• Each assigns one more node in , and never makes more unassigned, so within iterations it will end to a feasible assignment.
• Maintains optimality conditions.• Overall time:
![Page 11: Assignments and matchings Chapter 12 Presented by Yorai Geffen](https://reader036.vdocuments.mx/reader036/viewer/2022062322/5697bfec1a28abf838cb87b9/html5/thumbnails/11.jpg)
Stable Marriage Problem
• men and women.• Each man ranks each woman by perference
and vice versa (high means favored).• A (man,woman) pair is unstable if they’re not
married, but prefer each other• A perfect matching (marriage) is stable if it
does not contain any unstable pairs.
![Page 12: Assignments and matchings Chapter 12 Presented by Yorai Geffen](https://reader036.vdocuments.mx/reader036/viewer/2022062322/5697bfec1a28abf838cb87b9/html5/thumbnails/12.jpg)
Stable Marriage Problem cont.
• Input: Two preferences matrices.• W.L.O.G we assume each rank is an integer
between 1 to .• We use the matrices to construct priority list
for each person (decreasing order). Can be constructed in time.
![Page 13: Assignments and matchings Chapter 12 Presented by Yorai Geffen](https://reader036.vdocuments.mx/reader036/viewer/2022062322/5697bfec1a28abf838cb87b9/html5/thumbnails/13.jpg)
Stable Marriage iterative greedy algorithm
1. LIST = 2. m.current_woman = m’s top priority3. Until LIST = do:
1. For each m in LIST:1. m proposes to w = m.current_woman2. If w is unassigned and not engaged, then she’s now engaged to
m.3. If w is engaged, she chooses her preferred one and rejects the
other4. Rejected man r chooses the next on his priority list to be
r.current_woman5. Add\Remove man from LIST accordingly to engaged\rejected
AKA Propose-and-reject Algorithm
![Page 14: Assignments and matchings Chapter 12 Presented by Yorai Geffen](https://reader036.vdocuments.mx/reader036/viewer/2022062322/5697bfec1a28abf838cb87b9/html5/thumbnails/14.jpg)
Analysis
• Correctness: On board.• Complexity:– At each iteration, a woman receiving a proposal:
either (1) receiving her first proposal (once per woman), (2) rejects some proposal (at most times). Therefore steps per woman.
– In total, steps ( women).– Cannot be better: it is linear in the input data
length.
![Page 15: Assignments and matchings Chapter 12 Presented by Yorai Geffen](https://reader036.vdocuments.mx/reader036/viewer/2022062322/5697bfec1a28abf838cb87b9/html5/thumbnails/15.jpg)
Comments
• There could be several stable matchings.• A pair (i,j) is stable partners if some stable
match matches man i with woman j.• Algorithms property: Each man obtains his
best possible stable partner.• We refer to such a matching as man-optimal.
![Page 16: Assignments and matchings Chapter 12 Presented by Yorai Geffen](https://reader036.vdocuments.mx/reader036/viewer/2022062322/5697bfec1a28abf838cb87b9/html5/thumbnails/16.jpg)
Man-optimal proof (1)
• Lemma: In the propose-and-reject algorithm, a woman never rejects a stable partner.
• Proof:– the constructed matching by the algorithm.– Suppose the lemma is false.– The first time a woman rejects a stable partner.– Continue on board…
![Page 17: Assignments and matchings Chapter 12 Presented by Yorai Geffen](https://reader036.vdocuments.mx/reader036/viewer/2022062322/5697bfec1a28abf838cb87b9/html5/thumbnails/17.jpg)
Man-optimal proof (2)
• Lemma: The propose-and-reject algorithm constructs a man-optimal stable matching.
• Proof:– Immediate after the previous lemma:– The preferred stable-partner of a man will not
reject him, as by previous lemma.
![Page 18: Assignments and matchings Chapter 12 Presented by Yorai Geffen](https://reader036.vdocuments.mx/reader036/viewer/2022062322/5697bfec1a28abf838cb87b9/html5/thumbnails/18.jpg)
Nonbipartite cardinality matching problem – notations (1)
• – a node’s adjacency list• A matching of graph is a subset of arcs with
the property that no two arcs of are incident to the same node
• The arcs of are matched arcs, while the others are unmatched arcs.
• Nodes incident to matched arcs are matched nodes, else unmatched.
![Page 19: Assignments and matchings Chapter 12 Presented by Yorai Geffen](https://reader036.vdocuments.mx/reader036/viewer/2022062322/5697bfec1a28abf838cb87b9/html5/thumbnails/19.jpg)
Nonbipartite cardinality matching problem – notations (2)
• A path is an alternating path in if every consecutive pair of arcs in the path contains one matched and one unmatched arc.
• Odd\Even alternating path – as the number of arcs in the path.
• Alternating Cycle is an alternating path which starts and finishes on the same node.
![Page 20: Assignments and matchings Chapter 12 Presented by Yorai Geffen](https://reader036.vdocuments.mx/reader036/viewer/2022062322/5697bfec1a28abf838cb87b9/html5/thumbnails/20.jpg)
Nonbipartite cardinality matching problem – notations (3)
• Augmenting path – odd alternating path where the first and last nodes in the path are unmatched.– By switching the matches we augment the
cardinality by 1.• Symmetric difference of sets -
![Page 21: Assignments and matchings Chapter 12 Presented by Yorai Geffen](https://reader036.vdocuments.mx/reader036/viewer/2022062322/5697bfec1a28abf838cb87b9/html5/thumbnails/21.jpg)
Properties (1)
• If is a matching and is an augmenting path in , then is a matching of cardinality + 1. Moreover, in the matching, all the matched nodes in remain matched and two additional nodes, namely the first and last nodes of P, are matched. (augmentation)
• Explanation:
![Page 22: Assignments and matchings Chapter 12 Presented by Yorai Geffen](https://reader036.vdocuments.mx/reader036/viewer/2022062322/5697bfec1a28abf838cb87b9/html5/thumbnails/22.jpg)
Properties (2)
• If and are two matchings, their symmetric difference defines the subgraph with the property that every component is one of the six types shown here:
![Page 23: Assignments and matchings Chapter 12 Presented by Yorai Geffen](https://reader036.vdocuments.mx/reader036/viewer/2022062322/5697bfec1a28abf838cb87b9/html5/thumbnails/23.jpg)
Augmenting Path Theorem
• Theorem: If a node p is unmatched in a matching M, and this matching contains no augmenting path that starts at node p, then node p is unmatched in some maximum matching.
• Proof:– Let be a maximum matching. Assume p matched in , otherwise done.– Look at One of six figures. Yet p is unmatched in , so only (d) and (e)
are possible, when p is the starting node on the left.– No augmenting path rules out (d). So must be (e).– also maximum matching and p is unmatched.– Thus such a maximum matching exists.
![Page 24: Assignments and matchings Chapter 12 Presented by Yorai Geffen](https://reader036.vdocuments.mx/reader036/viewer/2022062322/5697bfec1a28abf838cb87b9/html5/thumbnails/24.jpg)
Bipartite Matching Algorithm
• is a maximum matching, by the previous theorem.• At each iteration, number of unmatched nodes reduces by
1 (either by matching or deleting).
![Page 25: Assignments and matchings Chapter 12 Presented by Yorai Geffen](https://reader036.vdocuments.mx/reader036/viewer/2022062322/5697bfec1a28abf838cb87b9/html5/thumbnails/25.jpg)
Finding an augmenting path from node p
• Search algorithm to identify all reachable nodes by alternating paths from p. If it finds an unmatched node reachable from p, we found the path. Else it does not exist.
• Complicated: Straight forward solves it for bipartite case, but it fails for the nonbipartite case.
![Page 26: Assignments and matchings Chapter 12 Presented by Yorai Geffen](https://reader036.vdocuments.mx/reader036/viewer/2022062322/5697bfec1a28abf838cb87b9/html5/thumbnails/26.jpg)
The straightforward approach
• Search tree from p to others via alternating path.• p – the root node (remember: p is unmatched)• The search tree – an alternating tree.• Nodes in the alternating tree – labeled, else
unlabeled. Each labeled node is even or odd depending on the unique path from p.
• If odd and unmatched – it is an augmenting path.• LIST of labeled nodes, examined one by one.• Assign label to its adjacencies (if unlabeled).
![Page 27: Assignments and matchings Chapter 12 Presented by Yorai Geffen](https://reader036.vdocuments.mx/reader036/viewer/2022062322/5697bfec1a28abf838cb87b9/html5/thumbnails/27.jpg)
Example
![Page 28: Assignments and matchings Chapter 12 Presented by Yorai Geffen](https://reader036.vdocuments.mx/reader036/viewer/2022062322/5697bfec1a28abf838cb87b9/html5/thumbnails/28.jpg)
Complexity
• Time: • Search and augment executed at most n times• Augment takes time.• Search takes time.– Examining an odd node takes – just the matching
arc.– Examining an even node takes , all its neighbors.
![Page 29: Assignments and matchings Chapter 12 Presented by Yorai Geffen](https://reader036.vdocuments.mx/reader036/viewer/2022062322/5697bfec1a28abf838cb87b9/html5/thumbnails/29.jpg)
Search algorithm
![Page 30: Assignments and matchings Chapter 12 Presented by Yorai Geffen](https://reader036.vdocuments.mx/reader036/viewer/2022062322/5697bfec1a28abf838cb87b9/html5/thumbnails/30.jpg)
Correctness of the search method
• If we find an augmenting path, it exists.• If we fail to find, can we conclude one does
not?
![Page 31: Assignments and matchings Chapter 12 Presented by Yorai Geffen](https://reader036.vdocuments.mx/reader036/viewer/2022062322/5697bfec1a28abf838cb87b9/html5/thumbnails/31.jpg)
Unique label property
• A graph is said to possess a unique label property with respect to a given matching and a root node p if the search procedure assigns a unique label to every labeled node (i.e., even or odd) irrespective of the order in which it examines labeled nodes.
• Use: If a graph poses this property, then if an augmenting path exists, the search will find it.– Proof: Take an augmenting path, label in its order. So
all other orders should be labeled the same.
![Page 32: Assignments and matchings Chapter 12 Presented by Yorai Geffen](https://reader036.vdocuments.mx/reader036/viewer/2022062322/5697bfec1a28abf838cb87b9/html5/thumbnails/32.jpg)
Unique label property cont.
• Bipartite networks satisfy this property.• If the root is in then every labeled node in will
receive an even label, and every labeled node in will receive an odd label.
• This is why the algorithm works in bipartite networks.
• Nonbipartite networks might not satisfy the unique label property, and therefore the search algorithm might fail to detect an augmenting path even though the network contains one.
![Page 33: Assignments and matchings Chapter 12 Presented by Yorai Geffen](https://reader036.vdocuments.mx/reader036/viewer/2022062322/5697bfec1a28abf838cb87b9/html5/thumbnails/33.jpg)
Nonbipartite network counter example
• Path 1-2-3-4-5 6 is given odd Augmenting path• Path 1-2-3-7-8-5 6 is not even scanned (not part of a
unique matched arc to 5). Thus the algorithm fails.• We can connect node 5 to the root by both an odd-length
and an even-length alternating path.
![Page 34: Assignments and matchings Chapter 12 Presented by Yorai Geffen](https://reader036.vdocuments.mx/reader036/viewer/2022062322/5697bfec1a28abf838cb87b9/html5/thumbnails/34.jpg)
Solution?
• Allow nodes to have both an even and odd labels, and scan it accordingly.
• Fails:
![Page 35: Assignments and matchings Chapter 12 Presented by Yorai Geffen](https://reader036.vdocuments.mx/reader036/viewer/2022062322/5697bfec1a28abf838cb87b9/html5/thumbnails/35.jpg)
Difficulty
• By assigning just one label to each node, we might overlook an augmenting path.
• By assigning two labels, we might falsely believe that we have found an augmenting path.
• Why? What is the cause?– Certain subgraphs called flowers, composed of
particular types of paths and odd cycles.
![Page 36: Assignments and matchings Chapter 12 Presented by Yorai Geffen](https://reader036.vdocuments.mx/reader036/viewer/2022062322/5697bfec1a28abf838cb87b9/html5/thumbnails/36.jpg)
Flowers and Blossoms
• A flower in respect to a matching and a root node p, is a subgraph with two components:1. Stem – An even length alternating path that
starts at p and terminates at some node w. If p = w, we say that the stem is empty.
2. Blossom – An odd length alternating cycle that starts and terminates at the terminal node w of a stem, and has no other node in common with the stem. We refer to node w as the base of the blossom.
![Page 37: Assignments and matchings Chapter 12 Presented by Yorai Geffen](https://reader036.vdocuments.mx/reader036/viewer/2022062322/5697bfec1a28abf838cb87b9/html5/thumbnails/37.jpg)
Properties (1)
a) A stem spans 2i nodes and contains i matched arcs for some integer i 0.
b) A blossom spans 2k + 1 nodes and contains k matched arcs for some integer k 1. The matched arcs match all nodes of the blossom except its base.
c) The base of a blossom is an even node.
![Page 38: Assignments and matchings Chapter 12 Presented by Yorai Geffen](https://reader036.vdocuments.mx/reader036/viewer/2022062322/5697bfec1a28abf838cb87b9/html5/thumbnails/38.jpg)
Properties (2)
• Every node i in the blossom (except its base) is reachable from the root p (or from the base of the blossom w) through two distinct alternating paths; one has even length and the other has odd length.
![Page 39: Assignments and matchings Chapter 12 Presented by Yorai Geffen](https://reader036.vdocuments.mx/reader036/viewer/2022062322/5697bfec1a28abf838cb87b9/html5/thumbnails/39.jpg)
Even nodes in blossom
• In a blossom – each node can receive both even and odd labels.
• We would prefer to give even labels to the nodes for the following reason: – Even-labeled nodes - we can label nodes outside
the blossom (all unmatched arcs incident to nodes in the blossom).
– Odd-labeled nodes - we label only the nodes in the blossom (matched arcs).
![Page 40: Assignments and matchings Chapter 12 Presented by Yorai Geffen](https://reader036.vdocuments.mx/reader036/viewer/2022062322/5697bfec1a28abf838cb87b9/html5/thumbnails/40.jpg)
Intuition
• If we assign all nodes in a blossom with even, the search algorithm will find an augmenting path.– All nodes in blossom are matched, except its base.• Can be reached with either an even or odd path.
– If stem is not empty – the base is matched too.
![Page 41: Assignments and matchings Chapter 12 Presented by Yorai Geffen](https://reader036.vdocuments.mx/reader036/viewer/2022062322/5697bfec1a28abf838cb87b9/html5/thumbnails/41.jpg)
Contracting a blossom (1)
• Popular approach: Shrink blossom to single node.
• Blossom B = turns to a node b (pseudonode – always even):– Neighbors: – Update neighbors: – To recover information we form a circular doubly
linked list of its nodes, and deleted them and all their arcs from the network (another update).
![Page 42: Assignments and matchings Chapter 12 Presented by Yorai Geffen](https://reader036.vdocuments.mx/reader036/viewer/2022062322/5697bfec1a28abf838cb87b9/html5/thumbnails/42.jpg)
Contracting a blossom (2)
• The result network the contracted network.
![Page 43: Assignments and matchings Chapter 12 Presented by Yorai Geffen](https://reader036.vdocuments.mx/reader036/viewer/2022062322/5697bfec1a28abf838cb87b9/html5/thumbnails/43.jpg)
Nonbipartite Matching Algorithm
• Search procedure assigns even or odd labels.• Algorithm will identify the possibility to assign even\
odd to an odd\even respectively.– When discovering we can assign different label than what
node i already has, we suspend the search. Trace back the indices of these paths until the first common node. That node is the base, and the nodes traced are the blossom.
– Then we contract it to a pseudonode.• If we find a path containing a pseudonodes, we expand
them one by one until none are in the path (pseudonode can contain other pseudonodes)
![Page 44: Assignments and matchings Chapter 12 Presented by Yorai Geffen](https://reader036.vdocuments.mx/reader036/viewer/2022062322/5697bfec1a28abf838cb87b9/html5/thumbnails/44.jpg)
Algorithm (1)
![Page 45: Assignments and matchings Chapter 12 Presented by Yorai Geffen](https://reader036.vdocuments.mx/reader036/viewer/2022062322/5697bfec1a28abf838cb87b9/html5/thumbnails/45.jpg)
Algorithm (2)
![Page 46: Assignments and matchings Chapter 12 Presented by Yorai Geffen](https://reader036.vdocuments.mx/reader036/viewer/2022062322/5697bfec1a28abf838cb87b9/html5/thumbnails/46.jpg)
Example - Finding
![Page 47: Assignments and matchings Chapter 12 Presented by Yorai Geffen](https://reader036.vdocuments.mx/reader036/viewer/2022062322/5697bfec1a28abf838cb87b9/html5/thumbnails/47.jpg)
Example - expanding
![Page 48: Assignments and matchings Chapter 12 Presented by Yorai Geffen](https://reader036.vdocuments.mx/reader036/viewer/2022062322/5697bfec1a28abf838cb87b9/html5/thumbnails/48.jpg)
Correctness (1)• Lemma, If contains an augmenting path starting at the root node p
(or the pseudonode containing p) with respect to the matching, then the original network contains an augmenting path starting at the root p with respect to the matching .
• Proof:– If does not contain a node b, then is valid in .
![Page 49: Assignments and matchings Chapter 12 Presented by Yorai Geffen](https://reader036.vdocuments.mx/reader036/viewer/2022062322/5697bfec1a28abf838cb87b9/html5/thumbnails/49.jpg)
Correctness (2)• Lemma, if contains an augmenting path from node p to node q
with respect to a matching , then contains an augmenting path from node p (or the pseudonode containing p) to node q with respect to the matching .
• Proof:– P in from p to q. Only unmatched nodes in .– If P has not node in common with a Blossom B, then P is also a path in the
contracted network – nothing to prove. So assume it has nodes in common.– Case 1 – stem is empty:
![Page 50: Assignments and matchings Chapter 12 Presented by Yorai Geffen](https://reader036.vdocuments.mx/reader036/viewer/2022062322/5697bfec1a28abf838cb87b9/html5/thumbnails/50.jpg)
Correctness (2) cont.• Proof (cont.):
– Case 2 – B has nonempty stem.– - even alternating path from p to w (base of B). – - p matched, w unmatched. – contains augmenting path in so in too. w,q are the only unmatched nodes in ,
so must contain an augmenting path between them.– matching of contracted graph in respect to .– In , B has an empty stem, so case 1 applies, and we have an augmenting path
after contracting the nodes of the blossom.– So contains an augmenting path with respect to the matching . But since and
have the same cardinality, must also contain an augmenting path with respect to the matching . This conclusion completes the proof of the lemma.
![Page 51: Assignments and matchings Chapter 12 Presented by Yorai Geffen](https://reader036.vdocuments.mx/reader036/viewer/2022062322/5697bfec1a28abf838cb87b9/html5/thumbnails/51.jpg)
Complexity of the Nonbipartite Matching Algorithm
• Lemma, during an execution of the search procedure, the algorithm performs at most contractions.
• Proof:– A blossom contains at least three nodes, and contracting
it produces one new node. So each contraction reduces the number of nodes by at least 2.
– Since the network initially contains n nodes, we can perform at most contractions between two augmentations.
![Page 52: Assignments and matchings Chapter 12 Presented by Yorai Geffen](https://reader036.vdocuments.mx/reader036/viewer/2022062322/5697bfec1a28abf838cb87b9/html5/thumbnails/52.jpg)
Complexity cont.
• Same as the bipartite, except contacts and expands blossom in the search procedure.
• Instead of deleting nodes in contractions, we declare them inactive. (same as to arcs)
• We check if active before examining it.• Increasing neighbors: contraction adds at most one
element to any, algorithm performs at most contractions, adjacency list will never contain more than elements, therefore it will not add to overall complexity.
![Page 53: Assignments and matchings Chapter 12 Presented by Yorai Geffen](https://reader036.vdocuments.mx/reader036/viewer/2022062322/5697bfec1a28abf838cb87b9/html5/thumbnails/53.jpg)
Complexity cont. (2)
• Time spent without contracting and expanding blossoms: For each node i, the search procedure performs one of the following operations at most once: 1) It discovers that node i is inactive, in which case it does nothing.2) It executes examine-odd(i, found).3) It executes examine-even(i, found).
• Clearly, the first two cases require 0(1) time.• The time for the third-step however, is proportional to. • The search procedure examines at most nodes.• We obtain a bound of on its running time, ignoring the time for
handling blossoms.
![Page 54: Assignments and matchings Chapter 12 Presented by Yorai Geffen](https://reader036.vdocuments.mx/reader036/viewer/2022062322/5697bfec1a28abf838cb87b9/html5/thumbnails/54.jpg)
Complexity cont. (3)
• Time for contracting blossoms:– Bottleneck: forming adjacency list for pseudonode b: .– Using the “Marking method” – first all nodes unmarked,
then examining the blossom nodes one by one, we mark all nodes in . When finished handling the blossom, we take all the marked nodes and say they’re .
– Each time we contract a blossom takes time (which we do times) plus time spent scanning
– Scanning sums to over all contractions. (each node – part of one blossom at most – turns inactive ; and number of arcs ).
![Page 55: Assignments and matchings Chapter 12 Presented by Yorai Geffen](https://reader036.vdocuments.mx/reader036/viewer/2022062322/5697bfec1a28abf838cb87b9/html5/thumbnails/55.jpg)
Complexity cont. (4)
• Time for expanding blossoms:– Suppose found augmenting path P from p to q.– We trace back from q until:
1. We arrived at node p.2. We encounter pseudonode. Then we expand.
– After at most iterations we obtain an augmenting path in the original network.
– We’ll show time to expand one blossom, and then it’ll be a total of • Say j first psudonode. Pred(i)=j. i not psudonode.• Marking approach to mark all nodes of B. Then scan to find a marked
node, say k. We then trace back through k’s matched arc, until the base of the blossom. From it, we trace back the path to p.
![Page 56: Assignments and matchings Chapter 12 Presented by Yorai Geffen](https://reader036.vdocuments.mx/reader036/viewer/2022062322/5697bfec1a28abf838cb87b9/html5/thumbnails/56.jpg)
Summary
• Bipartite cardinality matching - • Bipartite weighted matching -
• Stable Marriage Problem -
• Bipartite Matching Algorithm – • Nonbipartite Matching Algorithm -
![Page 57: Assignments and matchings Chapter 12 Presented by Yorai Geffen](https://reader036.vdocuments.mx/reader036/viewer/2022062322/5697bfec1a28abf838cb87b9/html5/thumbnails/57.jpg)
Questions?