89 PORD_INT count, u, v, i, istart, istop;
92 printf(
"\n#nodes %d, #edges %d, totvwght %d\n", G->
nvtx, G->
nedges >> 1,
94 printf(
"partition weights: S %d, B %d, W %d\n", Gbisect->
cwght[
GRAY],
96 for (u = 0; u < G->
nvtx; u++)
98 printf(
"--- adjacency list of node %d (weight %d, color %d)\n", u,
101 istop = G->
xadj[u+1];
102 for (i = istart; i < istop; i++)
104 printf(
"%5d (color %2d)", v, Gbisect->
color[v]);
105 if ((++count % 4) == 0)
108 if ((count % 4) != 0)
118{
PORD_INT *xadj, *adjncy, *vwght, *color, *cwght;
119 PORD_INT nvtx, err, checkS, checkB, checkW, a, b, u, v, i, istart, istop;
121 nvtx = Gbisect->
G->
nvtx;
122 xadj = Gbisect->
G->
xadj;
124 vwght = Gbisect->
G->
vwght;
125 color = Gbisect->
color;
126 cwght = Gbisect->
cwght;
129 printf(
"checking separator of induced subgraph (S %d, B %d, W %d)\n",
132 checkS = checkB = checkW = 0;
133 for (u = 0; u < nvtx; u++)
140 for (i = istart; i < istop; i++)
146 printf(
"WARNING: not a minimal separator (node %d)\n", u);
150 for (i = istart; i < istop; i++)
152 if (color[v] ==
WHITE)
153 { printf(
"ERROR: white node %d adjacent to black node %d\n", u,v);
162 printf(
"ERROR: node %d has unrecognized color %d\n", u, color[u]);
168 if ((checkS != cwght[
GRAY]) || (checkB != cwght[
BLACK])
169 || (checkW != cwght[
WHITE]))
170 { printf(
"ERROR in partitioning: checkS %d (S %d), checkB %d (B %d), "
171 "checkW %d (W %d)\n", checkS, cwght[
GRAY], checkB, cwght[
BLACK],
172 checkW, cwght[
WHITE]);
184 PORD_INT *color, *cwght, *map, nvtx, u, i;
186 nvtx = Gbisect->
G->
nvtx;
187 color = Gbisect->
color;
188 cwght = Gbisect->
cwght;
206 printf(
"\t 0. dom.dec.: #nodes %d (#domains %d, weight %d), #edges %d\n",
225 printf(
"\t %2d. dom.dec.: #nodes %d (#domains %d, weight %d), #edges %d"
243 printf(
"\t %2d. dom.dec. sep.: S %d, B %d, W %d [cost %7.2f]\n",
253 while (dd->
prev != NULL)
258 for (u = 0; u < dd2->
G->
nvtx; u++)
271 printf(
"\t %2d. dom.dec. sep.: S %d, B %d, W %d [cost %7.2f]\n",
283 for (u = 0; u < nvtx; u++)
284 color[u] = dd->
color[map[u]];
296 PORD_INT *xadj, *adjncy, *color, *cwght, *map;
297 PORD_INT *flow, *
rc, *matching, *dmflag, dmwght[6];
298 PORD_INT nvtx, smoothed, nX, nX2, nY,
x,
y, u, i, j, jstart, jstop;
300 nvtx = Gbisect->
G->
nvtx;
301 xadj = Gbisect->
G->
xadj;
303 color = Gbisect->
color;
304 cwght = Gbisect->
cwght;
316 for (i = 0; i < nX; i++)
317 {
x = bipartvertex[i];
320 for (j = jstart; j < jstop; j++)
322 if (color[
y] == black)
323 { bipartvertex[nX+nY++] =
y;
328 for (i = nX; i < nX+nY; i++)
329 {
y = bipartvertex[i];
339 switch(Gbipart->
G->
type)
355 fprintf(stderr,
"\nError in function smoothSeparator\n"
356 " unrecognized bipartite graph type %d\n", Gbipart->
G->
type);
361 printf(
"Dulmage-Mendelsohn decomp. computed\n"
362 "SI %d, SX %d, SR %d, BI %d, BX %d, BR %d\n", dmwght[
SI], dmwght[
SX],
363 dmwght[
SR], dmwght[
BI], dmwght[
BX], dmwght[
BR]);
372 if (
F(cwght[
GRAY]-dmwght[
SI]+dmwght[
BX], cwght[black]-dmwght[
BX],
373 cwght[white]+dmwght[
SI]) +
EPS <
F(cwght[
GRAY], cwght[black],
378 printf(
"exchange SI with BX\n");
381 cwght[white] += dmwght[
SI]; cwght[
GRAY] -= dmwght[
SI];
382 cwght[black] -= dmwght[
BX]; cwght[
GRAY] += dmwght[
BX];
383 for (i = 0; i < nX+nY; i++)
384 { u = bipartvertex[i];
385 if (dmflag[map[u]] ==
SI)
387 if (dmflag[map[u]] ==
BX)
399 if ((
F(cwght[
GRAY]-dmwght[
SR]+dmwght[
BR], cwght[black]-dmwght[
BR],
400 cwght[white]+dmwght[
SR]) +
EPS <
F(cwght[
GRAY], cwght[black],
402 && ((smoothed) || (dmwght[
SI] == 0)))
406 printf(
"exchange SR with BR\n");
409 cwght[white] += dmwght[
SR]; cwght[
GRAY] -= dmwght[
SR];
410 cwght[black] -= dmwght[
BR]; cwght[
GRAY] += dmwght[
BR];
411 for (i = 0; i < nX+nY; i++)
412 { u = bipartvertex[i];
413 if (dmflag[map[u]] ==
SR)
415 if (dmflag[map[u]] ==
BR)
424 for (i = 0; i < nX+nY; i++)
425 { u = bipartvertex[i];
426 if (color[u] ==
GRAY)
427 bipartvertex[nX2++] = u;
434 free(map); free(dmflag);
444{
PORD_INT *xadj, *adjncy, *vwght, *color, *cwght, *bipartvertex;
445 PORD_INT nvtx, nX, nX2, u,
x,
y, a, b, i, j, jstart, jstop;
447 nvtx = Gbisect->
G->
nvtx;
448 xadj = Gbisect->
G->
xadj;
450 vwght = Gbisect->
G->
vwght;
451 color = Gbisect->
color;
452 cwght = Gbisect->
cwght;
460 for (u = 0; u < nvtx; u++)
461 if (color[u] ==
GRAY)
462 bipartvertex[nX++] = u;
468 cwght[
GRAY] = nX2 = 0;
469 for (i = 0; i < nX; i++)
470 {
x = bipartvertex[i];
474 for (j = jstart; j < jstop; j++)
481 else if ((!a) && (b))
484 { bipartvertex[nX2++] =
x; cwght[
GRAY] += vwght[
x]; }
507 printf(
"\t separator smoothed: S %d, B %d, W %d [cost %7.2f]\n",
#define TIME_COARSEDOMDEC
#define OPTION_NODE_SELECTION3
gbisect_t * newGbisect(graph_t *G)
void constructSeparator(gbisect_t *Gbisect, options_t *options, timings_t *cpus)
void smoothSeparator(gbisect_t *Gbisect, options_t *options)
void checkSeparator(gbisect_t *Gbisect)
PORD_INT smoothBy2Layers(gbisect_t *Gbisect, PORD_INT *bipartvertex, PORD_INT *pnX, PORD_INT black, PORD_INT white)
void freeGbisect(gbisect_t *Gbisect)
void printGbisect(gbisect_t *Gbisect)
#define pord_starttimer(var)
#define pord_stoptimer(var)
#define mymalloc(ptr, nr, type)
#define MAX_COARSENING_STEPS
void DMviaMatching(gbipart_t *, PORD_INT *, PORD_INT *, PORD_INT *)
void freeDomainDecomposition(domdec_t *)
void DMviaFlow(gbipart_t *, PORD_INT *, PORD_INT *, PORD_INT *, PORD_INT *)
void freeBipartiteGraph(gbipart_t *)
void improveDDSep(domdec_t *)
void checkDomainDecomposition(domdec_t *)
gbipart_t * setupBipartiteGraph(graph_t *, PORD_INT *, PORD_INT, PORD_INT, PORD_INT *)
void checkDDSep(domdec_t *)
void shrinkDomainDecomposition(domdec_t *, PORD_INT)
void initialDDSep(domdec_t *)
domdec_t * constructDomainDecomposition(graph_t *, PORD_INT *)
void maximumFlow(gbipart_t *, PORD_INT *, PORD_INT *)
void maximumMatching(gbipart_t *, PORD_INT *)
struct _gbisect gbisect_t
struct _gbipart gbipart_t