package matrixbuilder;
//import mutipleInput.Join;
import java.util.*;
import java.io.*;

import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.conf.Configured;
import org.apache.hadoop.io.IntWritable;
import org.apache.hadoop.io.Text;
import org.apache.hadoop.io.Text;
import org.apache.hadoop.mapreduce.Job;
import org.apache.hadoop.mapreduce.Mapper;
import org.apache.hadoop.mapreduce.Reducer;
//import org.apache.hadoop.mapreduce.Mapper.Context;
import org.apache.hadoop.mapreduce.lib.input.FileInputFormat;
import org.apache.hadoop.mapreduce.lib.input.MultipleInputs;
import org.apache.hadoop.mapreduce.lib.input.TextInputFormat;
import org.apache.hadoop.mapreduce.lib.output.FileOutputFormat;
import org.apache.hadoop.util.Tool;
import org.apache.hadoop.util.ToolRunner;
import org.apache.hadoop.util.GenericOptionsParser;

import org.apache.hadoop.fs.Path;
import org.apache.hadoop.conf.*;
import org.apache.hadoop.io.*;
//import org.apache.hadoop.mapred.*;
import org.apache.hadoop.util.*;

import org.apache.hadoop.mapreduce.Job;
import org.apache.hadoop.mapreduce.Mapper;
import org.apache.hadoop.mapreduce.Reducer;
import org.apache.hadoop.mapreduce.lib.input.FileInputFormat;
import org.apache.hadoop.mapreduce.lib.output.FileOutputFormat;
import org.apache.hadoop.util.GenericOptionsParser;

public class MatrixBuilderReducer
     extends Reducer<VertexWritable,VertexOrCountWritable,PositionPairWritable,FloatWritable> {

  private ArrayList<VertexWritable> iVertices = new ArrayList<VertexWritable>();
  private int edgeCount;
  private boolean edgeCountEncountered;

  private void flushBuffer(VertexWritable iVertex,Context context){
    for(VertexWritable jVertex: iVertices)
      context.write(new PositionPairWritable(jVertex.get(),iVertex.get()),new FloatWritable(1/this.edgeCount));
  }
  //Input a Interable of either destination vertex or edgecount (for the given source vertex)
  public void reduce(VertexWritable iVertex, Iterable<VertexOrCountWritable> values, Context context) throws IOException, InterruptedException {
    for(VertexOrCountWritable v:values){
      if(v instanceof VertexWritable){
        VertexWritable jVertex = (VertexWritable)(v);
        if(edgeCountEncountered){
          context.write(new PositionPairWritable(jVertex.get(),iVertex.get()),new FloatWritable(1/this.edgeCount));
        }
        else{
          iVertices.add(x);
        }
      }
      else{ //type CountWritable
        this.edgeCountEncountered = true;
        CountWritable temp = (CountWritable)(x);
        this.edgeCount = temp.get();
        this.flushBuffer(iVertex,context);
      }
    }
  }
}

@@ -1481,25 +1481,22 @@
 itable%3E 
-iVertices
+buffer
  = new A
@@ -1689,25 +1689,22 @@
 Vertex: 
-iVertices
+buffer
 )%0A      
@@ -2183,16 +2183,22 @@
 table)(v
+.get()
 );%0A     
@@ -2380,22 +2380,25 @@
     
-iVertices.add(
+buffer.add(jVerte
 x);%0A
@@ -2490,16 +2490,16 @@
 = true;%0A
-
         
@@ -2536,16 +2536,22 @@
 table)(x
+.get()
 );%0A     

Fix the GenericWritable usage