1 / 7

Matching in bipartite graphs

Matching in bipartite graphs. initial matching. extending alternating path. Given: non-weighted bipartite graph. not covered node. Algorithm: so-called “extending alternating path”, we start with a not covered node; next step: node from the matching (maybe several edges)

octavia
Download Presentation

Matching in bipartite graphs

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Matching in bipartite graphs initial matching extending alternating path • Given: non-weighted bipartite graph not covered node Algorithm: so-called “extending alternating path”, we start with a not covered node; next step: node from the matching (maybe several edges) in this case: no extending alternating path; result: perfect matching

  2. Vertex Cover Problem • In general graphs is NP-hard (best approximation known - 2-approximation) • In bipartite graphs  exact algorithm (we can for sure find optimal matching with maximum # of edges) 1 2 minimum cardinality matching M 3 OPT = minimum vertex cover |OPT|  |M| Proof: we need at least 1 vertex in OPT per edge in M

  3. Vertex Cover Problem • In bipartite graphs |Maximum matching| = |Minimum vertex cover| • Algorithm (also the proof): Pick a node that covers red and blue edge (red=from M, blue=not from M) (except - last case) - such blue edge that has one endpoint not covered by the matching. If such blue edge does not exist, we have perfect matching (from that point on, all nodes are covered by the matching). Every time we have isolated node, we “drop” it

  4. Vertex Cover Problem • In case of perfect matching  take one part of the bipartite graph • In general graphs - not true Example: minimum cover maximum matching

  5. Homework solutions w2 Problem 1: Translate node weighted graph G= (G,V,w), where w: V  R+,intoedge weighted graph G’=(V,E,w’), w: E  R+, then apply Dijkstra on G’. w1+w2 w(e)= w1+w3 2 2 e w1 w3 v1 w6 w4 w5 For any edge e=vivk  E we define w’(e)=1/2 [w(vi)+w(vk)]. Then length(v0v1...vn-path in G)=length (v0v1...vn-path in G’)+ 1/2 w(v0) + 1/2 w(vn) (v0=source, vn= sink). The minimum weight path in G corresponds to a minimum weight path in G’.

  6. Homework solutions v1 v2 v3 V w(v2) =1 v2 2 Problem 2: For G=(V,E,w) we define a bipartite graph G’= (V+V’,E’,w’) : 2 1 3 3 2 2 3 3 V’ 3 v3 v1 v1’ v2’ v3’ • For each v  V define a “copy” v’ and an edge (v,v’), where • w(v,v’)=w(v) (corresponds to a loop in v in graph G) • Every edge (u,v)  E replace by 2 edges: (u,v’) and (u’,v) • with the same weight as (u,v) • G’ is bipartite (every edge has 1 end in V, other in V’) • Every path from v1 to vn = even • Every path from v1 to vn’ (“copy” of vn) = odd

  7. Homework solutions Problem 3: • G=(V,E,w). For each v  V define k “copies” : v1,v2,..., vk • Then create a directed graph G’=(V’,E’,w’), where V’=V V1  ...  Vk , vi1V1, ....vjkVk v u 1 1 For each edge (u,v)  E define edges (u,v1), (u1,v2), (u2,v3), ... (u(k-1),vk) with the same edge weight as (u,v). We look at all paths from v1(source) to vn(sink) or any copy ofvn. All such paths have at most k edges. 2 2 k k k  k edges shortest paths

More Related