3 /* Expands a blossom. Fixes up LINK and MATE. */
5 void UNPAIR (int oldbase, int oldmate)
9 printf("Unpair oldbase, oldmate=%d %d\n",oldbase, oldmate);
13 newbase = BMATE (oldmate);
14 if (newbase != oldbase) {
15 LINK [oldbase] = -DUMMYEDGE;
16 REMATCH (newbase, MATE[oldbase]);
18 LINK[secondmate] = -LASTEDGE[2];
19 else LINK[secondmate] = -LASTEDGE[1];
22 u = BEND (OPPEDGE (e));
24 POINTER (newbase, oldmate, e);
31 POINTER (u, v, -LINK[v]);
33 } while (u != newbase);
35 POINTER (newbase, oldmate, e);
39 /* changes the matching along an alternating path */
40 /* firstmate is the first base vertex on the path */
41 /* edge e is the new matched edge for firstmate */
43 void REMATCH (int firstmate, int e)
46 printf("Rematch firstmate=%d e=%d-%d\n",firstmate, END[OPPEDGE(e)], END[e]);
50 nexte = -LINK[firstmate];
51 while (nexte != DUMMYEDGE) {
55 secondmate = BEND (f);
56 nexte = -LINK[firstmate];
57 LINK[firstmate] = -MATE[secondmate];
58 LINK[secondmate] = -MATE[firstmate];
65 /* unlinks subblossoms in a blossom. oldbase is the base of the blossom to */
68 void UNLINK (int oldbase)
72 printf("Unlink oldbase=%d\n",oldbase);
76 newbase = NEXTVTX[oldbase];
77 nextbase = NEXTVTX[LASTVTX[newbase]];
81 nextedge = OPPEDGE (LINK[newbase]);
82 for (k=1; k <= 2; ++k) {
83 LINK[newbase] = -LINK[newbase];
86 while (i != nextbase) {
91 nextbase = NEXTVTX[LASTVTX[newbase]];
93 } while (LINK[nextbase] == nextedge);
95 LASTEDGE[1] = nextedge;
97 nextedge = OPPEDGE (e);
98 if (LINK[nextbase] == nextedge) {
102 LASTEDGE[2] = nextedge;
104 if (BASE[LASTVTX[oldbase]] == oldbase)
105 NEXTVTX[oldbase] = newbase;
107 NEXTVTX[oldbase] = DUMMYVERTEX;
108 LASTVTX[oldbase] = oldbase;