00001
00002
00003 UNPAIR (oldbase, oldmate)
00004 int oldbase, oldmate;
00005
00006 { int e, newbase, u;
00007
00008 #ifdef DEBUG
00009 printf("Unpair oldbase, oldmate=%d %d\n",oldbase, oldmate);
00010 #endif
00011
00012 UNLINK (oldbase);
00013 newbase = BMATE (oldmate);
00014 if (newbase != oldbase) {
00015 LINK [oldbase] = -DUMMYEDGE;
00016 REMATCH (newbase, MATE[oldbase]);
00017 if (f == LASTEDGE[1])
00018 LINK[secondmate] = -LASTEDGE[2];
00019 else LINK[secondmate] = -LASTEDGE[1];
00020 }
00021 e = LINK[oldmate];
00022 u = BEND (OPPEDGE (e));
00023 if (u == newbase) {
00024 POINTER (newbase, oldmate, e);
00025 return;
00026 }
00027 LINK[BMATE (u)] = -e;
00028 do {
00029 e = -LINK[u];
00030 v = BMATE (u);
00031 POINTER (u, v, -LINK[v]);
00032 u = BEND (e);
00033 } while (u != newbase);
00034 e = OPPEDGE (e);
00035 POINTER (newbase, oldmate, e);
00036 }
00037
00038
00039
00040
00041
00042
00043 REMATCH (firstmate, e)
00044 int firstmate, e;
00045
00046 {
00047 #ifdef DEBUG
00048 printf("Rematch firstmate=%d e=%d-%d\n",firstmate, END[OPPEDGE(e)], END[e]);
00049 #endif
00050
00051 MATE[firstmate] = e;
00052 nexte = -LINK[firstmate];
00053 while (nexte != DUMMYEDGE) {
00054 e = nexte;
00055 f = OPPEDGE (e);
00056 firstmate = BEND (e);
00057 secondmate = BEND (f);
00058 nexte = -LINK[firstmate];
00059 LINK[firstmate] = -MATE[secondmate];
00060 LINK[secondmate] = -MATE[firstmate];
00061 MATE[firstmate] = f;
00062 MATE[secondmate] = e;
00063 }
00064 }
00065
00066
00067
00068
00069
00070 UNLINK (oldbase)
00071 int oldbase;
00072
00073 { int k, j=1;
00074
00075 #ifdef DEBUG
00076 printf("Unlink oldbase=%d\n",oldbase);
00077 #endif
00078
00079 i = NEXTVTX[oldbase];
00080 newbase = NEXTVTX[oldbase];
00081 nextbase = NEXTVTX[LASTVTX[newbase]];
00082 e = LINK[nextbase];
00083 UL2:
00084 do {
00085 nextedge = OPPEDGE (LINK[newbase]);
00086 for (k=1; k <= 2; ++k) {
00087 LINK[newbase] = -LINK[newbase];
00088 BASE[i] = newbase;
00089 i = NEXTVTX[i];
00090 while (i != nextbase) {
00091 BASE[i] = newbase;
00092 i = NEXTVTX[i];
00093 }
00094 newbase = nextbase;
00095 nextbase = NEXTVTX[LASTVTX[newbase]];
00096 }
00097 } while (LINK[nextbase] == nextedge);
00098 if (j==1) {
00099 LASTEDGE[1] = nextedge;
00100 j++;
00101 nextedge = OPPEDGE (e);
00102 if (LINK[nextbase] == nextedge) {
00103 goto UL2;
00104 }
00105 }
00106 LASTEDGE[2] = nextedge;
00107
00108 if (BASE[LASTVTX[oldbase]] == oldbase)
00109 NEXTVTX[oldbase] = newbase;
00110 else {
00111 NEXTVTX[oldbase] = DUMMYVERTEX;
00112 LASTVTX[oldbase] = oldbase;
00113 }
00114 }
00115
00116