Binary matching Summary

Source: Internet
Author: User

Related questions:Http://blog.csdn.net/kksleric/article/details/7433909

Max matching Hungary algorithm:

A recursive method can be used to describe the augmented path. This description is not necessarily the most accurate, but it reveals the general method for finding the augmented path:

The "Augmented path starting from Vertex A" must first be connected to vertex B that is not paired with Vertex A in the original match. If point B is not paired with any vertex in the original match, it is the end point of the augmented path. Otherwise, if point B is paired with point C, then this augmented path is from A to B, then from B to C, plus the "Augmented path Starting from point C ". In addition, the augmented path starting from C cannot overlap with the augmented path in the first half.

An important theorem is required to complete the Hungarian algorithm:

If the augmented path is not found from A point A, no matter how many augmented paths are found from other points to change the current matching, the augmented path will never be found from.

Minimum Point Coverage: Minimum coverage requires that each edge be associated with at least one of the points with the least number of vertices (X set or Y set. It can be proved that the maximum number of matches in a bipartite graph is equal to the minimum vertex overwrite in this graph (König theorem)

(For the minimum vertex weight coverage problem with different vertex weights set to 1, use the cost stream solution)

Matrix67 provides proof: (To Be Honest, please indicate the source)

The Hungary algorithm requires us to exit from a point on the right that does not match so that "One is not matched, and the other is already matched, the next line does not match the path that appears in this way ). However, we have found the maximum match, and there is no such path. In other words, we can find many possible growth paths, but in the end we fail to find the "endpoint that has not been matched. We mark all such vertices: Starting from all the vertices on the right that have not been matched, all the points that can be reached according to the "alternate appearance" of the augmented path (the final path is many incomplete augmented paths ). These vertices form the least-covered point set: all vertices without marks on the right, plus vertices with marks on the left. As shown in the figure, two such paths are displayed on the right, marking a total of six points (marked with "√ ). Then, the three points circled in red are our minimum coverage point set.
First, why is the number of vertices exactly M? The answer is simple, because each vertex is an endpoint of a matching edge. If the vertex on the right has not been matched, it has long been marked as the start point. If the vertex on the left has not been matched, then you won't be able to go there (or you will find a complete augmented path ). However, a matching edge cannot be marked with the left endpoint and the right endpoint is not marked (otherwise, the right vertex can pass through this edge ). Therefore, the points we circled correspond to the matching edge one by one.
Secondly, why can the point set obtained in this way cover all edges? The answer is also simple. It is impossible to have an edge. Its left endpoint is not marked, while the right endpoint is marked. The reason is as follows: if this edge does not belong to our matching edge, the left endpoint can be reached through this edge (to mark it). If this edge belongs to our matching edge, therefore, the right endpoint cannot be the starting point of a path, so its tag can only be from the left endpoint of the edge (think about the definition of matching), and the left endpoint should be labeled.
Finally, why is this the smallest vertex coverage set? This is of course the smallest, and it is impossible to have a vertex coverage set smaller than M, because to overwrite the M matching edge, at least M points are required (return to the matching definition again ).


Minimum path coverage:Overwrite all nodes in directed acyclic graph G with a small number of non-Intersecting simple paths. To solve this problem, you can create a bipartite graph model. Split all vertex I into two: I in the X node set and I in the Y node set. If edge I-> j exists, edge I-> j is introduced in the bipartite graph ', if the maximum matching value of a bipartite graph is m, the result is n-m.
Maximum Independent Set Problem:Select m points in graph G of N points so that there is no edge between them. Calculate the maximum m value.
If graph G meets the condition of a bipartite graph, you can use Bipartite Graph Matching. Maximum number of independent set points = N-Maximum number of matching

Minimum vertex overwrite set = set of the maximum vertex Independent Set

Minimum vertex dominance set= Maximum number of matches = N-Maximum number of independent sets

Largest group(A set of vertices connected to any two points) = the maximum number of independent source images

Minimum edge coverage= Maximum Independent Set = point-maximum match

1.    Starting from the maximum matching, the minimum edge coverage set is obtained by adding the edge of the correlated uncovered vertex.

2.    Starting from the smallest edge cover set, the maximum matching is obtained by moving an adjacent edge.

Optimal Matching KM algorithm:

The KM algorithm converts the question of finding the maximum weight matching to the question of finding a complete match by giving each vertex a label (called the top mark. Set vertex Xi to A [I], vertex Yi to B [I], and edge weight between vertex Xi and Yj to w [I, j]. A [I] + B [j]> = w [I, j] is always valid for any edge (I, j) during Algorithm Execution. The correctness of the KM algorithm is based on the following theorem:

If all the subgraphs (called equal subgraphs) that meet the conditions of A [I] + B [j] = w [I, j] edge (I, j) if there is a complete match, this complete match is the maximum weight match of the Bipartite Graph.

This theorem is clear. For any matching of a bipartite graph, if it contains an equal subgraph, its edge weight is equal to the top mark and sum of all vertices. If its edge does not contain an equal subgraph, the edge weight is smaller than the top sum of all vertices. Therefore, the full match of an equal subgraph must be the maximum weight match of a bipartite graph.

In the initial stage, to make A [I] + B [j]> = w [I, j] Always stand, make A [I] the maximum weight of all edges associated with vertex Xi. B [j] = 0. If the current equality subgraph does not have a complete match, modify the top mark as follows to expand the equality subgraph until the equality subgraph has a complete match.

We fail to find the complete matching of the current equi-th subgraph because we cannot find an staggered path starting from an X vertex. In this case, we get an interleaved tree with all its leaf nodes being X vertices. Now, we can reduce all the top labels of X vertices in the staggered tree to a certain value d, and all the top labels of Y vertices Add the same value d. Then we will find that:

  • The value of the edge (I, j) and A [I] + B [j] In the staggered tree does not change. That is to say, it originally belongs to an equal subgraph and still belongs to an equal subgraph.
  • The two ends are not the edges (I, j) in the staggered tree, And neither A [I] nor B [j] are changed. That is to say, it originally belongs to (or does not belong to) equal subgraph, And now it still belongs to (or does not belong to) equal subgraph.
  • The X end is not in the staggered tree, and the Y end is in the edge (I, j) of the staggered tree. The value of A [I] + B [j] increases. It does not belong to an equal subgraph and does not belong to an equal subgraph.
  • The X end is in the staggered tree, and the Y end is not in the edge (I, j) of the staggered tree. The value of A [I] + B [j] is reduced. That is to say, it originally does not belong to an equal subgraph, And now it may have entered an equal subgraph, thus expanding the equal subgraph.

The problem now is to evaluate the value of D. To ensure that A [I] + B [j]> = w [I, j] is always valid, and at least one edge enters an equal subgraph, d should be equal to min {A [I] + B [j]-w [I, j] | Xi is in the staggered tree, Yi is not in the staggered tree }.

The above is the basic idea of the KM algorithm. However, in a simple implementation method, the time complexity is O (n4). You need to find the O (n) Increment path, and you need to modify the O (n) Increment path at most, each time you modify the top tag, the complexity is O (n2) because the enumeration edge is required to evaluate the D value ). In fact, the complexity of the KM algorithm is O (n3)
. Each Y vertex is given a "relaxation amount" function slack, Which is initialized to an infinite number every time the augmented path is searched. When you check the edge (I, j) in the process of searching for the augmented path, if it is not in the same subgraph, the slack [j] is converted into A smaller value of the original value and A [I] + B [j]-w [I, j. In this way, the minimum value of the slack value of all Y vertices not in the staggered tree can be used as the D value when the top mark is modified. Note that after the top mark is modified, all slack values must be subtracted from d.


Related Article

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.