The matching problem of graphs and maximum flow problem (v.) Calculation of maximum matching of binary graphs

Source: Internet
Author: User

The problem of the maximum matching of binary graphs the first one has said, the following look at Baidu Encyclopedia to give some explanations:

Given a binary graph g,m as a subset of the G-side set, M is a match if any of the two edges of the M-satisfies are not attached to the same vertex.

A maximum match (maximal Matching) is the number of matching edges that can no longer be added by adding an incomplete matching edge, under the currently completed match. The maximum match (maximum matching) is the maximum number of edges in any maximum match. Choosing the largest subset of such edges is called the maximum matching problem of graphs.

If in a match, each vertex in the diagram is associated with an edge in the diagram, the match is said to be an exact match, also known as a complete match.

The maximum matching of a binary graph can be computed using the maximum flow (maximal flows) or the Hungarian algorithm (Hungarian algorithm).

As shown in the figure, the maximum match is 4:.

Max-Flow method calculates maximum matching

The maximum flow problem has been explained a lot before, may wish to go back to familiar with the first. Ford-fulkerson solution of maximum flow problem

As shown in the diagram, for a binary graph, the capacity of an existing edge (Capacity) is infinity, adding a source point S and a meeting point T, so that s and T are connected to a step in the two diagram and set its capacity to 1. In this case, the flow network G is obtained, and the maximum flow calculated is equal to the maximum two-point matching.

However, we must also answer why this method is feasible. Here's a simple proof method. First of all, assuming that the current stream network has a maximum flow, but it does not correspond to the maximum match, then we can at least add a side to the maximum match, set to (U,V), obviously we can also add an augmented path, s->u->v->t. Then you get a bigger flow, and a hypothetical paradox. So the assumption is not tenable. Similarly, assuming that there is currently a maximum match, which corresponds to a maximum stream, there is at least one augmented path, assuming s->u->v->t. Then you can increase the edge (U,V) to the maximum match, the contradiction.

The code is very simple, constructs the flow network G ', then invokes the maximum flow algorithm to obtain the result. Because the number of any matching potential in the graph is min (l,r) (L represents the left part of the binary graph). R represents the right point set of the binary graph, so the value of the maximum flow in G ' is O (V), so it is possible to find the maximum match of the =o (VE) after the time of O (VE).

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.