27 rasso =
idxsmalloc(npart, 0,
"ComputeNCut: ncut");
34 for (i=0; i<nvtxs; i++)
38 for (i=0; i<nvtxs; i++) {
40 for (j=xadj[i]; j<xadj[i+1]; j++)
41 if (cm == where[adjncy[j]])
42 rasso[where[adjncy[j]]] ++;
46 for (i=0; i<nvtxs; i++){
48 for (j=xadj[i]; j<xadj[i+1]; j++)
49 if (cm == where[adjncy[j]])
50 rasso[where[adjncy[j]]] += adjwgt[j];
55 for (i=0; i<npart; i++){
70 idxtype *ncut, *degree, *xadj, *adjncy;
74 ncut =
idxsmalloc(npart, 0,
"ComputeNCut: ncut");
75 degree =
idxsmalloc(npart, 0,
"ComputeNCut: degree");
82 for (i=0; i<nvtxs; i++) {
84 for (j=xadj[i]; j<xadj[i+1]; j++){
86 if (cm != where[adjncy[j]])
92 for (i=0; i<nvtxs; i++) {
94 for (j=xadj[i]; j<xadj[i+1]; j++){
95 degree[cm] += adjwgt[j];
96 if (cm != where[adjncy[j]])
97 ncut[cm] += adjwgt[j];
103 for (i=0; i<npart; i++){
107 result += ncut[i] *1.0/ degree[i];
124 for (cut=0, i=0; i<graph->
nvtxs; i++) {
125 for (j=graph->
xadj[i]; j<graph->xadj[i+1]; j++)
126 if (where[i] != where[graph->
adjncy[j]])
131 for (cut=0, i=0; i<graph->
nvtxs; i++) {
132 for (j=graph->
xadj[i]; j<graph->xadj[i+1]; j++)
133 if (where[i] != where[graph->
adjncy[j]])
147 int i, j, nvtxs, nbnd;
148 idxtype *xadj, *adjncy, *where, *bndptr, *bndind;
150 nvtxs = graph->
nvtxs;
153 where = graph->
where;
157 for (nbnd=0, i=0; i<nvtxs; i++) {
158 if (xadj[i+1]-xadj[i] == 0)
161 for (j=xadj[i]; j<xadj[i+1]; j++) {
162 if (where[i] != where[adjncy[j]]) {
165 ASSERT(bndind[bndptr[i]] == i);
183 int i, j, nvtxs, nbnd, id, ed;
184 idxtype *xadj, *adjncy, *where, *bndptr, *bndind;
186 nvtxs = graph->
nvtxs;
189 where = graph->
where;
193 for (nbnd=0, i=0; i<nvtxs; i++) {
195 for (j=xadj[i]; j<xadj[i+1]; j++) {
196 if (where[i] != where[adjncy[j]])
201 if (ed -
id >= 0 && xadj[i] < xadj[i+1]) {
203 ASSERTP(bndptr[i] != -1, (
"%d %d %d\n", i,
id, ed));
204 ASSERT(bndind[bndptr[i]] == i);
218 int i, j, nvtxs, nbnd;
219 idxtype *xadj, *adjncy, *where, *bndptr, *bndind;
221 nvtxs = graph->
nvtxs;
224 where = graph->
where;
228 for (nbnd=0, i=0; i<nvtxs; i++) {
233 ASSERTP(nbnd == onbnd, (
"%d %d\n", nbnd, onbnd));
235 for (i=0; i<nvtxs; i++) {
237 ASSERTP(bndptr[i] == -1, (
"%d %d\n", i, bndptr[i]));
240 ASSERTP(bndptr[i] != -1, (
"%d %d\n", i, bndptr[i]));
271 int i, j, k, l, nvtxs, me, other;
272 idxtype *xadj, *adjncy, *adjwgt, *vwgt, *where;
275 nvtxs = graph->
nvtxs;
281 where = graph->
where;
286 pwgts[0] = pwgts[1] = pwgts[2] = 0;
287 for (i=0; i<nvtxs; i++) {
289 pwgts[me] += vwgt[i];
292 edegrees[0] = edegrees[1] = 0;
294 for (j=xadj[i]; j<xadj[i+1]; j++) {
295 other = where[adjncy[j]];
297 edegrees[other] += vwgt[adjncy[j]];
300 printf(
"Something wrong with edegrees: %d %d %d %d %d\n", i, edegrees[0], edegrees[1], graph->
nrinfo[i].
edegrees[0], graph->
nrinfo[i].
edegrees[1]);
306 if (pwgts[0] != graph->
pwgts[0] || pwgts[1] != graph->
pwgts[1] || pwgts[2] != graph->
pwgts[2])
307 printf(
"Something wrong with part-weights: %d %d %d %d %d %d\n", pwgts[0], pwgts[1], pwgts[2], graph->
pwgts[0], graph->
pwgts[1], graph->
pwgts[2]);
318 int i, j, nvtxs, other;
319 idxtype *xadj, *adjncy, *where;
321 nvtxs = graph->
nvtxs;
324 where = graph->
where;
326 for (i=0; i<nvtxs; i++) {
329 other = (where[i]+1)%2;
330 for (j=xadj[i]; j<xadj[i+1]; j++) {
331 ASSERTP(where[adjncy[j]] != other, (
"%d %d %d %d %d %d\n", i, where[i], adjncy[j], where[adjncy[j]], xadj[i+1]-xadj[i], xadj[adjncy[j]+1]-xadj[adjncy[j]]));
float ComputeRAsso(GraphType *graph, idxtype *where, int npart)
float ComputeNCut(GraphType *graph, idxtype *where, int npart)
int CheckNodePartitionParams(GraphType *graph)
int CheckBnd2(GraphType *graph)
int ComputeCut(GraphType *graph, idxtype *where)
int CheckBnd(GraphType *graph)
int IsSeparable(GraphType *graph)
int CheckRInfo(RInfoType *rinfo)
int CheckNodeBnd(GraphType *graph, int onbnd)
#define ASSERTP(expr, msg)
void clusterSize(GraphType *graph, int *clustersize)