}
@SuppressWarnings("unchecked")
public static GraphJob createJob(String[] args, HamaConfiguration conf)
throws IOException {
GraphJob pageJob = new GraphJob(conf, PageRank.class);
pageJob.setJobName("Pagerank");
pageJob.setVertexClass(PageRankVertex.class);
pageJob.setInputPath(new Path(args[0]));
pageJob.setOutputPath(new Path(args[1]));
// set the defaults
pageJob.setMaxIteration(30);
pageJob.set("hama.pagerank.alpha", "0.85");
if (args.length == 6)
pageJob.setNumBspTask(Integer.parseInt(args[5]));
if (args.length >= 5)
pageJob.setMaxIteration(Integer.parseInt(args[4]));
if (args.length >= 4)
pageJob.set("hama.graph.max.convergence.error", args[3]);
if (args.length >= 3)
pageJob.set("hama.pagerank.alpha", args[2]);
// error, dangling node probability sum
pageJob.setAggregatorClass(AverageAggregator.class,
DanglingNodeAggregator.class);
pageJob.setVertexIDClass(Text.class);
pageJob.setVertexValueClass(DoubleWritable.class);
pageJob.setEdgeValueClass(NullWritable.class);
pageJob.setInputKeyClass(LongWritable.class);
pageJob.setInputValueClass(Text.class);
pageJob.setInputFormat(TextInputFormat.class);
pageJob.setVertexInputReaderClass(PagerankTextReader.class);
pageJob.setPartitioner(HashPartitioner.class);
pageJob.setOutputFormat(TextOutputFormat.class);
pageJob.setOutputKeyClass(Text.class);
pageJob.setOutputValueClass(DoubleWritable.class);
return pageJob;
}