// if there are only two vertices, we have a diagonal
// we want to preserve whatever is currently in the diagonal,
// since this is acting as a running sum of all other values
// that have been "cut" so far - simply return this element as is
if (count == 2) {
VertexWritable vw = new VertexWritable(i, j, k, "unimportant");
context.write(new Text(String.valueOf(i)), vw);
return;
}
// do we zero out the values?
VertexWritable outI = new VertexWritable();
VertexWritable outJ = new VertexWritable();
if (zero) {
// increment the cut counter
context.getCounter(CUTSCOUNTER.NUM_CUTS).increment(1);
// we want the values to exist on the diagonal
outI.setCol(i);
outJ.setCol(j);
// also, set the old values to zero
VertexWritable zeroI = new VertexWritable();
VertexWritable zeroJ = new VertexWritable();
zeroI.setCol(j);
zeroI.setValue(0);
zeroJ.setCol(i);
zeroJ.setValue(0);
zeroI.setType("unimportant");
zeroJ.setType("unimportant");
context.write(new Text(String.valueOf(i)), zeroI);
context.write(new Text(String.valueOf(j)), zeroJ);
} else {
outI.setCol(j);
outJ.setCol(i);