The nearest team is popular, can't fall, huh, I also see. The two-point graph refers to a picture: all of its vertices are divided into two sets M and N, where the two of the two in M or N are not connected in the same episode. The two-point map matching is a set of edges, where the vertices are in two collections, and the two are not the same vertices, which are called the matching of the two-point map, and the maximum side that can be obtained Number, called maximum match.
Calculate the algorithm of the two-point graphs There is a network stream algorithm and Hungarian algorithm (now you know these two), where the Hungarian algorithm is smart, the specific process is as follows (transfer from combined mathematics):
Let G = (x, *, y) is a two-point diagram, where x = {x1, x2 ...}, y = {Y1, Y2, ....}. Let M make any match in G. 1. All the X of all the vertices associated with the edge of the M sides are ¥, and all the vertices are not scanned. Go to 2. 2. If there is no new tag to X-based vertices on the previous step, stop, otherwise, turn 3 3. When there is an X tag but not scanned, select a vertex that is marked but not scanned, such as XI, with (Xi) tag Y, these vertices are not mdrawal, and the side that has not been marked. Connect to xi. Now the vertex xi is scanned. If there is no vertex that is marked but not scanned, turn 4. 4. If there is no new tag in step 3, stop, otherwise it will turn 5. 5. When the y is labeled but not scanned. A vertex that is marked but not scanned, such as YJ, with (YJ) tag X, which is bound to YJ. Now, the vertex yj is scanned. If there is no vertex that is marked but not scanned, turn 2. Since each vertex is mostly marked once and because each vertex is scanned up to once, this matching algorithm terminates within a limited step.
Code:
BFS process:
#include
#include
Bool Map [MAX] [MAX], Searched [MAX]; int Prev [MAX], M, N;
BOOL DFS (INT DATA) {INT I, TEMP; for (i = 0; I