简体   繁体   中英

Greedy algorithm by selecting vertices with least number of edges for maximum matching?

I'm learning Blossom Algorithm, but I am confused why you can't simply do this greedy approach that I thought of. Does anyone have a counterexample?

While no more vertices:
    Choose the vertex (V) with the least number of edges
    Considering vertices connected to that vertex V, choose one with the least number of edges.
    Create this edge and don't consider these two vertices anymore. 
    Reduce the count of edges on each vertex accordingly. Repeat
E         G
|\       /|
| A-B-C-D |
|/       \|
F         H

If at the first step you choose BC, you lose, because you are left with 2 odd cycles and you cannot cover all the vertices. The optimal matching is AB CD EF GH.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM