Pku acm 1466 girls and boys Data Structure Problem Solving report (17th) -- Hungarian algorithm for maximum matching of Bipartite Graph

Source: Internet
Author: User
Read another article on my blog before reading this articleArticle:HungaryAlgorithmReturns the maximum matching value of a bipartite graph.). With the foundation of the Hungarian algorithm, this is a very simple question: the question provides some boys and girls, some people have a romantic history, such as A and B have a romantic history, then B and a have a romantic history, asking the maximum number of people, there is no romantic history between them, according to such a rule to build a bipartite map: Boy and girl divided on both sides, respectively as the left and right nodes, according to the rule if there is romance connected, otherwise not connected, find the maximum match, N-max_number_of_couples/2 is the result of the requirement, because A and B have romance, then B and a have a romance, so we can repeat it once (in this case, a and B can remove one ).With detailed comments CodeYou can Http://download.csdn.net/user/china8848/get

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.