Presentation is loading. Please wait.

Presentation is loading. Please wait.

Bipartite Matching and Other Graph Algorithms

Similar presentations


Presentation on theme: "Bipartite Matching and Other Graph Algorithms"— Presentation transcript:

1 Bipartite Matching and Other Graph Algorithms

2 Bipartite graph and Bipartite matching
Divide into two groups, A and B All edges are from something in group A to something in group B Bipartite matching Want to uniquely match one item from group A with one item in group B Called Maximum Cardinality Bipartite Matching (MCBM) Notice: Bipartite matching must have bipartite graph where |A| = |B| Given a bipartite graph, can do analysis to find a MCBM

3 Maximum Cardinality Bipartite Matching
Assign a source with an edge to every vertex in set 1 Assign a sink with an edge from every vertex in set 2 Run Max Flow If it can find flow of amount equal to |A| (and therefore |B|), we have a match If sets are unequal size, will find the best possible match (all of one should match to something from other, if possible)

4 Max Independent Set and Min Vertex Cover
Independent Set: no two vertices in set have edge between them Vertex Cover: every vertex is adjacent to some vertex in the set Number of vertices in min vertex cover is number in MCBM Number of vertices in max independent set is total number minus number in MCBM Note that finding these is a little different (but can use the MCBM matching for this)

5 MCBM with Augmenting Paths
Start at a free vertex (on “left”) Find a free edge to a vertex on “right”. Assume it is already matched. Follow the matched edge back to the “left” Repeat until reaching a free vertex on the right Then, reverse the order of all edges visited (from “free” <-> “matched” Easy to implement (relatively) and fast enough on most cases.

6 Edge-disjoint paths Paths in graphs – how many paths do not share an edge Convert each edge to a unit-weight edge If the graph is undirected, form two edges for each (one per direction) Max flow in the graph is the number of edge-disjoint paths

7 Circulation Each node has either supply or demand, edges have capacity
Create a new source with edges to the nodes with supply Edge weights are the amount of supply (negated) Create a new sink with edges from the nodes with demand Edge weights are the amount of demand Then, just run max flow! Several problems can be modeld as circulation problems

8 Other Graph Types DAG (Directed Acyclic Graph): Tree Eulerian Graph
Graph with an Eulerian path or tour: visits each edge exactly once Several algorithms can be simplified if the graph is of one of these types See book for examples


Download ppt "Bipartite Matching and Other Graph Algorithms"

Similar presentations


Ads by Google