Overview of maximum matching and bipartite graph Creation

Source: Internet
Author: User

I. Two theorem about maximum matching of bipartite graphs:


1: Maximum number of matching + maximum independent set = N + M (n, m is the number of two parts in the diagram)
2: The minimum overwrite count of the Bipartite Graph = the maximum number of matching

3: Minimum path overwrite = Maximum Independent Set


The largest independent set refers to finding the largest point set in a bipartite graph. The points in the set are not connected to each other.


The minimum vertex overwrite refers to the use of the least vertex in a bipartite graph to associate all edges with at least one vertex.


The minimum path overwrite refers to a directed graph G without loops. A path overwrite of G is a set of non-intersecting paths p, each node in the figure contains only one path in P. The path can start and end from any node, and the length is also any value, including 0


The maximum matching algorithm of Bipartite Graph: http://blog.csdn.net/no_retreats/article/details/7854091


Common graph creation models: (The following is a summary of other resources)

Model 1: row-column matching

1 0 1
0 1 0
1 0 0

As described in, it is a 3*3 matrix, where 1 indicates that there are enemies, and 0 indicates that there are no enemies. We now have multiple arrows, and each arrow can kill one or more enemies. The question is, how many arrows do we need to kill all enemies?

At the beginning, it seems that there is no connection with the bipartite graph, but we can try to think about the problem from another angle. Do we want to kill the enemy if there is an arrow passing by him, that is to say, all the enemies will be covered by arrows. Well, that's right. It's overwrite, and the smallest vertex overwrite. Since we want to kill the enemy, our point should be the enemy's position. As long as an arrow passes through the enemy's position, the enemy will be killed by us. Therefore, we need to create a graph based on the points, and regard the cross-coordinate of the points as the X part of the bipartite graph, and the vertical coordinate as the y part of the Bipartite Graph. We can see that the enemy's position is (), so we can see the bipartite graph with the horizontal and vertical coordinates of coordinates, the edge connected by the edge is the point where the enemy is located.

The minimum vertex overwrite of a bipartite graph is to find the least edge to overwrite all the vertices, which exactly meets the requirements of this question. The above also gives a property, that is, the minimum vertex overwrite of a bipartite graph is equal to the maximum matching of a bipartite graph. Therefore, we only need to match the above Bipartite Graph with the maximum value. This makes it easy to change the original problem.


Model 2: black and white Staining

1 0 1
1 1 1
0 0 1

For example, if it is still a 3*3 matrix, the problem now is that you can change 1 in the graph to 0, and you can only modify the adjacent two at a time, how many times does it take to change all 1 to 0? It seems that we are greedy and DP is useless. Of course we propose here to use the maximum matching of bipartite graphs to solve the problem. The key here is how to create a graph? Since we can only get two adjacent ones at a time, we also find two matching results when matching them. This is where the problem is related to the biggest bipartite graph matching problem. But each point can match the four points around him. How can we divide all the points into that part? One solution is to place vertex I in the first part, four vertices around vertex I in the second part, and then 16 vertices around these four vertices in part 1st.
With this idea, we only need to make such changes to the source image: black and white colors make the surrounding and middle colors different.

 

Black and white in the figure means to classify the points. The values of 1, 2, 3, 4, 5, and 6 represent the number of 1 in the 0, 1 graph above.
Create a graph to connect adjacent points, such as 1 and 2 2 and 3 .......


Then, we need to change all vertices to zero, that is, we need to operate on each vertex and each vertex must have it. Isn't that the minimum vertex overwrite? Well, yes, it's still the smallest vertex overwrite.

 



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.