Download presentation
Published byMagdalen Small Modified over 9 years ago
1
Homework - hints Problem 1. Node weights Edge weights
single source shortest paths problem (SSSP) 1/2 1/2 s Return:shortest path and its length 1 Hint sink 2 3 Problem 2: Shortest even (or odd) path Hint: create a copy of each node bipartite graph, add necessary edges so that, for edge (u,v) in the new graph you always come to v in even paths and to copy of v in odd paths. Problem 3: for extra points
2
Matching in Bipartite Graphs “ assignment problem”
Problem: Given: bipartite graph, find the maximum # of edges that do not overlap Job assignment problem Jobs Job nobody can do Employees cannot do anything - at the same time assign only 1 job to 1 employee
3
Matching in Bipartite Graphs “ assignment problem”
Find a job assignment such that each job is assigned to one employee and vice versa. -there is a solution in polynomial time -we need to find “extending alternating paths”: start with a node that’s not covered edge not covered end in not covered node
4
Matching in Bipartite Graphs
remove Blue = matching red = so-called free node When we go down always red, when we go up always green Claim: if there is no alternating path, we cannot add more matching (no improvement)
5
Matching in Bipartite Graphs
node v M’, v M M v M Claim:no extending alternating path this is the maximum possible matching Proof: assume, on the contrary, that larger matching exists: M’ there is a node v M’, v M M+M’ has some connected components remove from M+M’ , in the rest still |M| < |M’|
6
Minimum Weight Matching
Problem: Given: complete bipartite graph with weights on edges. Find minimum weight matching. ( G = (A B, E,w) ) |A| = |B| w R, not R+ +1 +1 +1 +1 any matching will increase by 1 (if we add +1 to weights of all edges outgoing from a fixed node)
7
Computation Geometry Application of Matching
crystal defects non-convex points - all pieces rectangular, cut in vertical (or horizontal) cuts Problem: minimize # of cats - only 90, 180, 270 cuts (180 -we don’t care about), 270 - problem Fact: if we make a cut from each non-convex point, then the pieces are rectangles. if we solve matching of non convex, then we find the optimum
8
Minimum Weight Matching
If we change weights with the above procedure, and come to a graph with perfect matching (all nodes matched), of zero weight, then M is minimum weight matching! - we do not change matching by adding and subtracting - for each node v, v A subtract min(v) = min u B w(v,u) next time algorithm
9
Matching in Bipartite Graphs
Repeat from v’ M’, v’ M. Either we find alternating path or there will be no edges in M and M’ contradiction to |M| < |M’|
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.