// 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 out_i = new VertexWritable();
VertexWritable out_j = new VertexWritable();
if (zero) {
// increment the cut counter
context.getCounter(CUTSCOUNTER.NUM_CUTS).increment(1);
// we want the values to exist on the diagonal
out_i.setCol(i);
out_j.setCol(j);
// also, set the old values to zero
VertexWritable zero_i = new VertexWritable();
VertexWritable zero_j = new VertexWritable();
zero_i.setCol(j);
zero_i.setValue(0);
zero_j.setCol(i);
zero_j.setValue(0);
zero_i.setType("unimportant");
zero_j.setType("unimportant");
context.write(new Text(String.valueOf(i)), zero_i);
context.write(new Text(String.valueOf(j)), zero_j);
} else {
out_i.setCol(j);
out_j.setCol(i);