Examples of GraphJob


Examples of org.apache.hama.graph.GraphJob

      InterruptedException, ClassNotFoundException {
    if (args.length < 2)
      printUsage();

    HamaConfiguration conf = new HamaConfiguration(new Configuration());
    GraphJob pageJob = createJob(args, conf);

    long startTime = System.currentTimeMillis();
    if (pageJob.waitForCompletion(true)) {
      System.out.println("Job Finished in "
          + (System.currentTimeMillis() - startTime) / 1000.0 + " seconds");
    }
  }
View Full Code Here

Examples of org.apache.hama.graph.GraphJob

  }

  @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;
  }
View Full Code Here

Examples of org.apache.hama.graph.GraphJob

    }
  }

  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");
    // reference vertices to itself, because we don't have a dangling node
    // contribution here
    pageJob.set("hama.graph.self.ref", "true");
    pageJob.set("hama.graph.max.convergence.error", "0.001");

    if (args.length == 3) {
      pageJob.setNumBspTask(Integer.parseInt(args[2]));
    }

    // error
    pageJob.setAggregatorClass(AverageAggregator.class);

    // Vertex reader
    pageJob.setVertexInputReaderClass(PagerankSeqReader.class);

    pageJob.setVertexIDClass(Text.class);
    pageJob.setVertexValueClass(DoubleWritable.class);
    pageJob.setEdgeValueClass(NullWritable.class);

    pageJob.setInputFormat(SequenceFileInputFormat.class);

    pageJob.setPartitioner(HashPartitioner.class);
    pageJob.setOutputFormat(TextOutputFormat.class);
    pageJob.setOutputKeyClass(Text.class);
    pageJob.setOutputValueClass(DoubleWritable.class);
    return pageJob;
  }
View Full Code Here

Examples of org.apache.hama.graph.GraphJob

      InterruptedException, ClassNotFoundException {
    if (args.length < 2)
      printUsage();

    HamaConfiguration conf = new HamaConfiguration(new Configuration());
    GraphJob pageJob = createJob(args, conf);

    long startTime = System.currentTimeMillis();
    if (pageJob.waitForCompletion(true)) {
      System.out.println("Job Finished in "
          + (System.currentTimeMillis() - startTime) / 1000.0 + " seconds");
    }
  }
View Full Code Here

Examples of org.apache.hama.graph.GraphJob

  public static GraphJob getJob(String inpath, String outpath,
      Optional<Integer> numBspTasks) throws IOException {
    // Graph job configuration
    HamaConfiguration conf = new HamaConfiguration();
    GraphJob inlinkJob = new GraphJob(conf, InlinkCount.class);
    // Set the job name
    inlinkJob.setJobName("Inlink Count");

    inlinkJob.setInputPath(new Path(inpath));
    inlinkJob.setOutputPath(new Path(outpath));

    if (numBspTasks.isPresent()) {
      inlinkJob.setNumBspTask(numBspTasks.get());
    }

    inlinkJob.setVertexClass(InlinkCount.class);

    inlinkJob.setInputFormat(TextInputFormat.class);
    inlinkJob.setInputKeyClass(Text.class);
    inlinkJob.setInputValueClass(TextArrayWritable.class);

    inlinkJob.setVertexIDClass(Text.class);
    inlinkJob.setVertexValueClass(IntWritable.class);
    inlinkJob.setEdgeValueClass(NullWritable.class);

    inlinkJob.setPartitioner(HashPartitioner.class);
    inlinkJob.setOutputFormat(SequenceFileOutputFormat.class);
    inlinkJob.setOutputKeyClass(Text.class);
    inlinkJob.setOutputValueClass(IntWritable.class);
    return inlinkJob;
  }
View Full Code Here

Examples of org.apache.hama.graph.GraphJob

    if (args.length < 2)
      printUsage();

    Optional<Integer> absent = Optional.absent();
    GraphJob inlinkJob = getJob(args[0], args[1],
        args.length >= 3 ? Optional.of(Integer.parseInt(args[3])) : absent);

    long startTime = System.currentTimeMillis();
    if (inlinkJob.waitForCompletion(true)) {
      System.out.println("Job Finished in "
          + (System.currentTimeMillis() - startTime) / 1000.0 + " seconds");
    }
  }
View Full Code Here

Examples of org.apache.hama.graph.GraphJob

    System.exit(-1);
  }

  public static GraphJob createJob(String[] args, HamaConfiguration conf)
      throws IOException {
    GraphJob job = new GraphJob(conf, BipartiteMatching.class);

    // set the defaults
    job.setMaxIteration(30);
    job.setNumBspTask(2);
    conf.set(SEED_CONFIGURATION_KEY, System.currentTimeMillis() + "");

    if (args.length == 5)
      conf.set(SEED_CONFIGURATION_KEY, args[4]);
    if (args.length >= 4)
      job.setNumBspTask(Integer.parseInt(args[3]));
    if (args.length >= 3)
      job.setMaxIteration(Integer.parseInt(args[2]));

    job.setJobName("BipartiteMatching");
    job.setInputPath(new Path(args[0]));
    job.setOutputPath(new Path(args[1]));

    job.setVertexClass(BipartiteMatchingVertex.class);
    job.setVertexIDClass(Text.class);
    job.setVertexValueClass(TextPair.class);
    job.setEdgeValueClass(NullWritable.class);

    job.setInputFormat(TextInputFormat.class);
    job.setVertexInputReaderClass(BipartiteMatchingVertexReader.class);
    job.setPartitioner(HashPartitioner.class);
    job.setOutputFormat(TextOutputFormat.class);
    job.setOutputKeyClass(Text.class);
    job.setOutputValueClass(TextPair.class);
    return job;
  }
View Full Code Here

Examples of org.apache.hama.graph.GraphJob

      printUsage();
    }

    HamaConfiguration conf = new HamaConfiguration(new Configuration());

    GraphJob job = createJob(args, conf);

    long startTime = System.currentTimeMillis();
    if (job.waitForCompletion(true)) {
      System.out.println("Job Finished in "
          + (System.currentTimeMillis() - startTime) / 1000.0 + " seconds");
    }
  }
View Full Code Here

Examples of org.apache.hama.graph.GraphJob

    }
  }

  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");
    // reference vertices to itself, because we don't have a dangling node
    // contribution here
    pageJob.set("hama.graph.self.ref", "true");
    pageJob.set("hama.graph.max.convergence.error", "0.001");

    if (args.length == 3) {
      pageJob.setNumBspTask(Integer.parseInt(args[2]));
    }

    // error
    pageJob.setAggregatorClass(AverageAggregator.class);

    // Vertex reader
    pageJob.setVertexInputReaderClass(PagerankSeqReader.class);

    pageJob.setVertexIDClass(Text.class);
    pageJob.setVertexValueClass(DoubleWritable.class);
    pageJob.setEdgeValueClass(NullWritable.class);

    pageJob.setInputFormat(SequenceFileInputFormat.class);

    pageJob.setPartitioner(HashPartitioner.class);
    pageJob.setOutputFormat(TextOutputFormat.class);
    pageJob.setOutputKeyClass(Text.class);
    pageJob.setOutputValueClass(DoubleWritable.class);
    return pageJob;
  }
View Full Code Here

Examples of org.apache.hama.graph.GraphJob

      InterruptedException, ClassNotFoundException {
    if (args.length < 2)
      printUsage();

    HamaConfiguration conf = new HamaConfiguration(new Configuration());
    GraphJob pageJob = createJob(args, conf);

    long startTime = System.currentTimeMillis();
    if (pageJob.waitForCompletion(true)) {
      System.out.println("Job Finished in "
          + (System.currentTimeMillis() - startTime) / 1000.0 + " seconds");
    }
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.