@Override
protected void reduce(Text row, Iterable<VertexWritable> entries,
Context context) throws IOException, InterruptedException {
// now to assemble the vectors
RandomAccessSparseVector output = new RandomAccessSparseVector(
context.getConfiguration().getInt(EigencutsKeys.AFFINITY_DIMENSIONS, Integer.MAX_VALUE), 100);
int rownum = Integer.parseInt(row.toString());
for (VertexWritable e : entries) {
// first, are we setting a diagonal?
if (e.getCol() == rownum) {
// add to what's already present
output.setQuick(e.getCol(), output.getQuick(e.getCol()) + e.getValue());
} else {
// simply set the value
output.setQuick(e.getCol(), e.getValue());
}
}
context.write(new IntWritable(rownum), new VectorWritable(output));
}