Http://www.cnblogs.com/justPassBy/p/5369930.html
Http://www.cnblogs.com/ka200812/archive/2011/07/31/2122641.html
Theorem: Konig theorem: The number of points that the minimum point of a binary graph covers = maximum match.
Number of edges covered by minimum path = vertex number n Maximum number of matches
Maximum independent set = minimum path cover = vertex number n Maximum matching number
Augmented path theorem: Using an unnamed point to indicate a point adjacent to any matching edge, other point-bit matching points, that is, a point that exactly matches a boundary critical. Set off from the cover point, followed by a mismatched edge, matching edges, mismatched edges, matching edges ... The resulting path is called Alternate road. Note that if an alternate path ends with an open point, the alternate path is called an augmented path. In the augmented path, a mismatched edge is one more than the matching edge. The effect of the augmented path is to improve the match. If there is an augmented path, then the matching side of the road and the mismatched side of the swap, the match is more than just one side. Conversely, if the augmented path is not found, the current match is the maximum match.
To find the augmented path, there is an augmented path to exchange the unmatched and matching edges of the augmented path, which will make the current maximum number of matches +1. Minimum path overlay for Dag
Definition: In a forward graph, find the least path so that these paths pass through all the points.
The minimum path overlay is divided into minimal disjoint path overlay and minimal intersecting path overlay.
Minimum disjoint path overlay: Each path passes through a different vertex. As shown in the figure, the minimum path coverage number is 3. namely 1->3>4,2,5.
Minimal intersecting path overrides: Each path passes through the same vertex. If it has a minimum path overlay of 2. namely 1->3->4,2->3>5.
In particular, each point itself can also be called a path overlay, except that the length of the path is 0.
dag minimum disjoint path overlay
Algorithm: The original image of each point V into Vxvx and vyvy two points, if there is a a->b to the edge, then add Edge ax−>byax−>by. So we get a two-point graph. Then the minimum path overlay = The number of nodes in the original image-the maximum match for the new graph.
Proof: At the beginning each point is independent for a path, with a total of n disjoint paths. Each time we find a matching edge in a binary graph, it is equivalent to combining two paths into one path, which is equivalent to a 1 reduction in the number of paths. So we found a few matching edges and the number of paths decreased. So there is a minimum path cover = the number of vertices of the original image-the maximum match for the new graph.
Because there cannot be a common point between paths, there can be no public points between the edges of the addition, which is the definition of the match.
Exercise: POJ1422
Main.cpp//POJ1422 min do not want to cross path overlay/////Created by Bemaster on 16/4/8. COPYRIGHT©2016 year Bemaster.
All rights reserved. #include <iostream> #include <stdio.h> #include <string.h> #include <vector> using namespace s
td
const int N = 200 + 10;
Vector<int> G[n];
int cy[n];
BOOL Vis[n];
bool Dfs (int u) {for (int i=0; i<g[u].size (); ++i) {int v = g[u][i];
if (Vis[v]) continue;
VIS[V] = true;
if (Cy[v]==-1 | | dfs (CY[V])) {Cy[v] = u;
return true;
return false;
int solve (int n) {int ret = 0;
memset (CY,-1, sizeof (CY));
for (int i=1;i<=n;++i) {memset (Vis, 0, sizeof (VIS));
ret = DFS (i);
return n-ret;
int main (int argc, const char * argv[]) {int t,n,m;
int u,v;
scanf ("%d", &t);
while (t--) {scanf ("%d%d", &n,&m);
for (int i=1;i<=n;++i) g[i].clear (); for (int i=0;i<m;++i) {scanf ("%d%d", &u,&v);
G[u].push_back (v);
int ans = solve (n);
printf ("%d\n", ans);
return 0; }
dag minimum intersecting path overlay
Algorithm: First use Floyd to find the transfer closure of the original image, that is, if a to B has a path, then add Edge a->b. It is then converted to the minimum disjoint path coverage problem.
Proof: In order to connect two points, a path may pass through the middle point of other paths. Like 1->3->4,2->4->5. But if two points A and B are connected, except that the middle needs to pass through other points, then you can add an edge between the two points, then a can go straight to B, without having to pass through the midpoint, then convert to the minimum disjoint path overlay.
Title: POJ2594
Main.cpp//POJ2594 min. intersect path Overlay////Created by Bemaster on 16/4/8. COPYRIGHT©2016 year Bemaster.
All rights reserved. #include <iostream> #include <stdio.h> #include <string.h> #include <vector> using namespace s
td
const int N = 500 + 10;
BOOL Dis[n][n];
BOOL Vis[n];
int cy[n];
void Floyd (int n) {for (int i=1;i<=n;++i) for (int j=1;j<=n;++j) for (int k=1;k<=n;++k)
if (Dis[i][k] && dis[k][j])//transitive accessibility dis[i][j] = true; bool Dfs (int u, int n) {for (int i=1;i<=n;++i) {if (!vis[i] && dis[u][i]) {Vis[i] = Tru
E
if (Cy[i]==-1 | | DFS (cy[i], n)) {cy[i] = u;
return true;
}} return false;
int solve (int n) {int cnt = 0;
memset (cy,-1,sizeof (CY));
for (int i=1;i<=n;++i) {memset (vis,0,sizeof (VIS));
CNT + = DFS (i, n);
return n-cnt; int main (int argc, const char * argv[]) {int n,m;
int a,b;
while (scanf ("%d%d", &n,&m), n+m) {for (int i=1;i<=n;++i) for (int j=1;j<=n;++j)
DIS[I][J] = false;
for (int i=1;i<=m;++i) {scanf ("%d%d", &a,&b);
Dis[a][b] = true;
} Floyd (n);
int ans = solve (n);
printf ("%d\n", ans);
return 0; }
Noticeable problems of minimum path coverage problem
First, the minimum path overlay = Total number of nodes-the maximum number of matches. This should already be a secret.
The minimum path overlay, which is the least number of paths in a direction graph, is used to cover the entire graph.
The noteworthy place here, if there is the intersection of the edges of the graph, then it is not easy to find the original binary matching
For example, suppose there is a graph: 1->2 2->5 2->3 4->2, in fact, this is actually two edges: 1->5 4->3, Node 2 is only one of their intersections
If it is simply based on the original image to find a binary match, then get the matching answer is 2, the minimum path cover answer is 5-2=3.
But any look can see the clue, this figure, only need two points can explore the entire map, where the minimum path coverage is obviously 2.
What exactly is the problem? Actually, it's about the intersection 2. Since the edges are intersecting, their connectedness should also be connected.
The solution is to carry out a closure of the original artwork (that is, flody), and then added four edges: 1->3 1->5 4->3 4->5
Then the maximum number of matches, matching the answer is 3, the minimum path coverage value of 2, this is the correct answer.