Learning bipartite graphs: Basic Ideas (Yang) (clip Version)

Source: Internet
Author: User

Edit blog posts from other friends. Thank you!

 

The Hungary algorithm is used to find the maximum matching of binary graphs.


(1) Prerequisites
What is a bipartite graph? A bipartite graph is also called a Binary Graph. It is a special model in graph theory. Set G = (V, E) to an undirected graph. If vertex v can be divided into two subsets (a, B) that do not overlap with each other, and each edge (I, j) in the graph) the two associated vertex I and j belong to these two different vertex sets (I in a, J in B) respectively. Then, graph G is called a bipartite graph.



What is matching: think of three men and four women as targets (non-gay), the line represents mutual affection, but in the end only one wife and one wife, and the final matching result is a match. Matching can be empty.
What is the biggest match: On the basis of favorable feelings, we can develop up to a few pairs.

Now we need to use the Hungary algorithm to find at most several available pairs.
[Color = Green] [size = medium]
The Hungary algorithm is used to find the maximum matching of binary graphs.

(2) Body of the Hungarian algorithm:
The Hungarian algorithm has a very, very important concept called "staggered path" or "staggered Tree", which refers to the same thing. The staggered path is like this. There is a black line to match



The staggered path is:



The starting and ending points of the staggered path must not be the matching points, and the matching edges must alternate in the staggered path.
First, let's give an example.
1. No matching at the beginning



2. Select the first X point to find the first line


3. Select the second vertex to find the second link.



4, found that the first side of X3 x3y1 has been occupied by people, find out the x1y1 starting from the staggered path x3-y1-x1-y4, the cross path has been in the matching side x1y1 removed from the matching, add the remaining side x3y1 x1y4 to the matching



5. Similarly, add X4 and X5.

The Hungarian algorithm can give priority to depth or breadth. In the preceding example, the depth is given priority. That is, if the X3 algorithm matches Y1 and Y1, the algorithm returns a staggered path. If the breadth is preferred, it should be: X3 to find Y1, Y1 to match, X3 to find Y2.

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.