Debian Codegraph @

extern/metis/libmetis/separator.c

raw
1 /*
2 * Copyright 1997, Regents of the University of Minnesota
3 *
4 * separator.c
5 *
6 * This file contains code for separator extraction
7 *
8 * Started 8/1/97
9 * George
10 *
11 * $Id: separator.c 10481 2011-07-05 18:01:23Z karypis $
12 *
13 */
14
15 #include "metislib.h"
16
17 /*************************************************************************
18 * This function takes a bisection and constructs a minimum weight vertex
19 * separator out of it. It uses the node-based separator refinement for it.
20 **************************************************************************/
21 void ConstructSeparator(ctrl_t *ctrl, graph_t *graph)
22 {
23 idx_t i, j, k, nvtxs, nbnd;
24 const idx_t *xadj;
25 idx_t *where, *bndind;
26
27 WCOREPUSH;
28
29 nvtxs = graph->nvtxs;
30 xadj = graph->xadj_orig ? graph->xadj_orig : graph->xadj;
31 nbnd = graph->nbnd;
32 bndind = graph->bndind;
33
34 where = icopy(nvtxs, graph->where, iwspacemalloc(ctrl, nvtxs));
35
36 /* Put the nodes in the boundary into the separator */
37 for (i=0; i<nbnd; i++) {
38 j = bndind[i];
39 if (xadj[j+1]-xadj[j] > 0) /* Ignore islands */
40 where[j] = 2;
41 }
42
43 FreeRData(graph);
44
45 Allocate2WayNodePartitionMemory(ctrl, graph);
46 icopy(nvtxs, where, graph->where);
47
48 WCOREPOP;
49
50
51 Compute2WayNodePartitionParams(ctrl, graph);
52
53 FM_2WayNodeRefine2Sided(ctrl, graph, 1);
54 FM_2WayNodeRefine1Sided(ctrl, graph, 4);
55
56
57 }