Skip to content

Commit

Permalink
Fixed issue of k-way boundary of inconsistently ignoring island verti…
Browse files Browse the repository at this point in the history
…ces.
  • Loading branch information
karypis committed Jan 17, 2022
1 parent 5a82977 commit f247ed9
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
4 changes: 4 additions & 0 deletions libmetis/kwayfm.c
Original file line number Diff line number Diff line change
Expand Up @@ -488,6 +488,8 @@ void Greedy_KWayCutOptimize(ctrl_t *ctrl, graph_t *graph, idx_t niter,
*======================================================================*/
for (pass=0; pass<niter; pass++) {
ASSERT(ComputeCut(graph, where) == graph->mincut);
if (omode == OMODE_REFINE)
ASSERT(CheckBnd2(graph));

if (omode == OMODE_BALANCE) {
/* Check to see if things are out of balance, given the tolerance */
Expand Down Expand Up @@ -1152,6 +1154,8 @@ void Greedy_McKWayCutOptimize(ctrl_t *ctrl, graph_t *graph, idx_t niter,
*======================================================================*/
for (pass=0; pass<niter; pass++) {
ASSERT(ComputeCut(graph, where) == graph->mincut);
if (omode == OMODE_REFINE)
ASSERT(CheckBnd2(graph));

/* In balancing mode, exit as soon as balance is reached */
if (omode == OMODE_BALANCE && IsBalanced(ctrl, graph, 0))
Expand Down
4 changes: 1 addition & 3 deletions libmetis/kwayrefine.c
Original file line number Diff line number Diff line change
Expand Up @@ -426,7 +426,6 @@ void ProjectKWayPartition(ctrl_t *ctrl, graph_t *graph)
}

graph->nbnd = nbnd;

}
ASSERT(CheckBnd2(graph));
break;
Expand Down Expand Up @@ -507,7 +506,6 @@ void ProjectKWayPartition(ctrl_t *ctrl, graph_t *graph)
icopy(nparts*graph->ncon, cgraph->pwgts, graph->pwgts);

FreeGraph(&graph->coarser);
graph->coarser = NULL;

WCOREPOP;
}
Expand All @@ -532,7 +530,7 @@ void ComputeKWayBoundary(ctrl_t *ctrl, graph_t *graph, idx_t bndtype)
/* Compute the boundary */
if (bndtype == BNDTYPE_REFINE) {
for (i=0; i<nvtxs; i++) {
if (graph->ckrinfo[i].ed-graph->ckrinfo[i].id >= 0)
if (graph->ckrinfo[i].ed > 0 && graph->ckrinfo[i].ed-graph->ckrinfo[i].id >= 0)
BNDInsert(nbnd, bndind, bndptr, i);
}
}
Expand Down

0 comments on commit f247ed9

Please sign in to comment.