protected void map(LongWritable key, Text value, Mapper<LongWritable, Text, IntWritable, Text>.Context context)
throws IOException, InterruptedException {
String[] record = value.toString().split("\t");
String vertex = record[0];
String neighborhood = record[1];
context.write(new IntWritable(Integer.valueOf(vertex)), new Text(neighborhood));
String[] neighborhoodList = neighborhood.split(" ");
for(String v : neighborhoodList) {
context.write(new IntWritable(Integer.valueOf(v)), new Text(neighborhood)); //这个neighborhood要转换为文件key对应的value
}
} |