Two-part picture lecture hall--complete deal with maximum number of matches (minimum number of covers), maximum independent number, minimum path coverage, weighted optimal matching

Source: Internet
Author: User
Tags split terminates

Two-part picture lecture hall----------complete the maximum number of matches (minimum number of covers), maximum independent number, minimum path coverage, weighted optimal match (RPM)

Text Content frame:

§ 1 Concepts and properties of arguments, edge sets and binary graphs

§ 22 Maximum matching solution of the graph

Hungarian algorithm, Hopcroft-karp algorithm

§ 32 The construction of the minimum covering set and the maximum independent set of graphs

§ 42 min Path Overlay Solution

§ 52 Fractal graph with weighted optimal matching solution

Kuhn-munkers algorithm

§6 Summary

Each chapter explains in detail the problem introduction, the algorithm principle and the analysis, the algorithm flow, the algorithm realizes four parts content, seeks to solve the problem thoroughly.

§ 1 Concepts and properties of arguments, edge sets and binary graphs

Point overlay, minimum point overlay

A point overlay set is a set of points so that all edges have at least one endpoint in the collection. Or "point" overrides all "edges". Minimum coverage (minimal vertex covering): It is a point overlay and its true subset is not. Minimum point overlay (minimum vertex covering): points with minimal point coverage. Point overlays (vertex covering number): The minimum point to overwrite the points.

Edge overlay, Minimal edge overlay

An edge overlay set is a set of edges that makes all points contiguous to the edges in the collection. Or "side" overrides all "points". Minimal edge overlay (minimal edge covering): It is an edge overlay and its true subset is not. Minimum edge Overlay (minimum edge covering): Edge overlay with minimal edge. Edge covering Number: The number of edges covered by the minimum edge.

Independent set, maximal independent set

The independent set is a set of points, and any two nodes in the collection are not adjacent, then V is a stand-alone set. Or, the exported sub-graph is a set of 0 (without edges) of points. Maximal independent set (maximal independent set): itself is a set of independent, then added to any point is not. Maximum independent set (maximum independent set): The most independent set of points. Independent number (independent): The point of the largest independent set.

Mission

A group is a point set that is adjacent to any two nodes in the collection. Or, the exported sub-graph is the point set of the full graph. Great Regiment (Maximal clique): itself as a regiment, and then join any point is not. Largest regiment (maximum clique): the most points of the regiment. Regiment (clique number): The largest group of points.

Edge Independent set, maximal edge Independent set

An edge independent set is a set of edges that satisfies either side of an edge set that is not contiguous. Maximal edge independent set (maximal Edge Independent set): Is itself a side independent set, then joins any edge is not. Maximum Edge independent set (maximum Edge Independent set): Edge-independent set with most edges. Edge Independent Number: The number of sides of the maximum edge independent set.

The Edge Independent set is also called match (matching), corresponding has the maximal match (maximal matching), the maximum match (maximum matching), the match number (matching numbers).

Dominating set, minimum dominating set

A dominating set is a set of points, so that all other points have at least one adjacent point in the collection. Or a part of the "point" dominates all the "dots". Minimum dominating set (minimal dominating set): itself is the dominating set, and its true subset is not. Minimum dominating set (minimum dominating set): The minimum dominating set of points. Domination number (dominating numbers): The minimum dominating set of points.

Edge dominating set, minimum edge dominating set

The edge-dominating set is a set of edges, so that all edges have at least one contiguous edge in the collection. Or a part of the "side" dominates all the "sides". Minimum edge control set (minimal edge dominating set): is itself a set of edge domination, and its true subset is not. Minimum Edge-dominating set (minimum edge dominating set): Edge-dominating set with minimal edges. Edge dominating number: the number of edges of the minimum edge-dominating set.

Minimum path Overlay

Minimum path overwrite (path covering): Is the "path" overlay "point", that is, with as few disjoint simple paths as possible to cover all the vertices of the direction-free graph G, that is, each vertex strictly belongs to a path. The length of the path may be 0 (single point).

Minimum path overlay number of =g-the number of edges in the minimum path overlay. You should make as many sides as possible in the minimum path overlay, but you cannot allow two edges to intersect at the same vertex. Split: Splits each vertex I into two vertices xi and Yi. Then, according to the information from the edge of the original, from X to the y edge. The direction of all sides is from X to Y. Therefore, the maximum number of matches for a binary graph is the number of edges on the smallest path overlay in the original G. Therefore, the maximum number of hits by the minimum path cover number = The vertex of the original G-two graph can be solved.

The

The match (matching) is a set of edges that satisfies the edge 22 not adjacency in the edge set. The match is also known as The Edge Independent set (Edge Independent set).

The point in the match is called the match point (matched vertex) or the saturation point, and conversely, the mismatch (unmatched vertex) or the non-saturation points .

The staggered track (alternating path) is a simple path of the graph that satisfies any adjacent two edges, one within the match and one not in the match .

Augmented orbit (augmenting path): A staggered track with a start point and an end point that are not matched.

The maximum match (maximum matching) is the most multilateral match.

The match count (matching number) is the size of the maximum match.

The perfect match (perfect matching) is the match for all points.

Perfect Match (complete matching) is a match of all points that match the smaller set of two (sub-graph x, y, and small).

Augmented orbit theorem: A match is the maximum match when and only if there is no augmented orbit.

all matching algorithms are based on the augmented orbit theorem: A match is the maximum match when and only if there is no augmented orbit. This theorem applies to any intention.

the properties of binary graphs

In a binary graph, the number of point overlays is the number of matches.
(1) The maximum matching number of the binary graph is equal to the minimum covering number, that is, the least point makes each edge at least one point associated with it, it is obvious that the maximum matching node can be directly taken.
(2) The independent number of the binary graph is equal to the vertex number minus the maximum number of matches, it is obvious that the points at both ends of the maximum match are removed from the vertex set this time the remaining points are independent sets, which is | v|-2*| M|, at the same time, it is necessary to take a point from each end of each matching edge to join the independent set and maintain its independent set nature.
(3) The minimum path of the DAG overlay, each point is split after the maximum match, the result is n-m, the specific path of the time along the matching side to go, matching edge i→j ', J→k ', k→l ' .... form a forward path.

(4) Maximum number of matches = left match point + right unmatched point. Because any edge in the maximum matching set, if his left is unmarked and the right is marked, then we can find a new augmented path, so each edge is at least covered by a dot.

(5) Minimum side overlay = number of points in the graph-maximum number of matches = Maximum independent set.

the determination of the dichotomy graph

A binary graph is a graph with two vertex sets and two vertices of each edge of the graph in two vertices set, with no edges connected directly to each vertex set.

The sufficient and necessary condition for the two-point graph of the graph G is that G has at least two vertices and that all of its loops are of an even length.

The common method of judging the dichotomy is staining: begin to dye any one of the non-staining vertex, then judge its adjacent vertex, if not dyed then will be infected with the adjacent vertex different color, if it has been dyed and the color and the adjacent vertices of the same color is not a binary picture, if the color is different, continue to judge, BFS and Dfs can be done.

easy to know: Any non-circuit diagram is a two-part diagram.

§ 22 Maximum matching solution of the graph

§2.1 Problem Brief

Set g= (v,e) is an no-map. such as Vertex set V can be divided into two disjoint subsets of the v1,v2, and each edge of the graph two vertices attached to each of these two different subsets. It is said that figure G is a two-point figure. The dichotomy chart can also be recorded as g= (V1,v2,e).

Given a binary graph G, in a sub-figure m of G, any two edges in M's edge set {E} are not attached to the same vertex, then M is a match. Selecting a subset with the largest number of edges in such a subset is called the maximum matching problem for graphs (maximal matching problem)

In a match, each vertex in the diagram is associated with an edge in the graph, which is called an exact match, also known as a complete, perfect match.

§2.2 Hungarian algorithm

Hungarian algorithmic Thinking

Based on A match is the maximum match when and only if there is no augmented path, the maximum match is to find the augmented orbit, until the augmented orbit is found, and the maximum match is obtained. Traverse each point to find the augmented path, and if the augmented path is found, modify the matching set and the number of matches, otherwise, terminate the algorithm and return the maximum number of matches.

The nature of the augmented path must be satisfied

1. There is an odd number of edges.

2. Start at the left half of the dichotomy, ending at the right half.

3. The point on the path must be one on the left half, one in the right half, alternating. (In fact, the nature of the binary chart determines this point, because the two points of the same side of the point is not connected to the side, do not forget oh.) )

4. There are no duplicate points on the entire path.

5. The starting and ending points are not currently paired, and all the other points are well-matched.

6. All the odd-number edges on the path are not in the original match, and all of the even-odd bars appear in the original match.

7. Finally, and most importantly, the addition of all the odd bars on the augmented path to the original match, and the deletion of all the odd bars in the augmented path from the original match (this operation is called the inverse of the augmented path), the new match number is 1 more than the original match number (odd = even +1).

The length of the augmented path that is found each time is extended on the basis of the last augmented path found, so that each update match number is incremented by 1.

The Hungarian algorithm Step (g = (x,*,y) is a binary graph where X = {x1,x2,... xm}, Y = {y1,y2,... yn}. Make M any match in G)

(1) m is empty

(2) from the G to find an unmatched point V (the augmented Road properties 5 requirements), if not the algorithm ends, otherwise, the beginning of V, to find the augmented path (the adjacency point is an unmatched point, then return to find the completion, if V's adjacency point U is a matching point, then you start to find the end of an unmatched point) Satisfies the nature of the augmented path , and if no augmented path is found, the algorithm terminates

(3) Find an augmented path p, by XOR or operation to obtain a larger match m ' instead of m (easy to output augmented matrix and further search), match number plus 1 (property 7 Get)

(4) Repeat (2) (3) operation until the augmented path is not found

A thorough understanding of the augmented path lookup method

1. Always start from an unmatched point in the X-set, looking for a match or an unmatched point, such that the augmented path terminates if an unmatched point is found, otherwise the augmented path of the point does not exist.

2. Each search augmentation path is based on a previously formed match (above step 3 in the same or after the match) on the basis of the extension, that is, the search match is always in the match m, in fact, with the starting point and the end of two unmatched points to get the matching edge as far as possible to connect the augmented path, so that the length of the It is also possible to directly add an edge (directly to the match) with two unmatched points. All in all, each expansion match is not augmented by an extension path or a new augmented path (with a length of 1, of course).

Complexity of time space

Time Complexity adjacency matrix: The Worst O (n^3) adjacency table: O (MN) spatial complexity adjacency matrix: O (n^2) adjacency table: O (m+n)

╝②

Hungarian algorithm implementation

The Hungarian algorithm only needs to find an augmented path at each node as the starting point to obtain the maximum match, the complexity of finding the augmented path is O (E), and the total complexity is O (VE).

The following implementation is to find a match from X to Y , each point in X can only be traversed once to find the augmented path (when it is already a match point is not traversed), the DFS is detailed comments, if still do not understand, you can provide free of charge.

Dfs

The CPP code #define MAXN 10//represents the maximum number of vertices in the X and Y sets.     The number of vertices in the int nx,ny;//x collection and y collection int edge[maxn][maxn];//edge[i][j] to 1 means that IJ can match the int cx[maxn],cy[maxn];//to record which of the matching y elements in the X collection.     The int visited[maxn];//is used to record whether the vertex has been accessed.         int path (int u) {int V; for (v=0;v<ny;v++)

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.