Examples of GraphJob


Examples of org.apache.hama.graph.GraphJob

      ClassNotFoundException {
    deleteTempDirs();
    generateTestData();
    try {
      HamaConfiguration conf = new HamaConfiguration();
      GraphJob job = BipartiteMatching.createJob(new String[] { INPUT, OUTPUT,
          "30", "2" }, conf);
      job.setPartitioner(CustomTextPartitioner.class);

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

      verifyResult();
View Full Code Here

Examples of org.apache.hama.graph.GraphJob

  }

  public void testMindistSearch() throws Exception {
    generateTestData();
    try {
      GraphJob job = MindistSearch.getJob(INPUT, OUTPUT, Optional.of(3),
          Optional.of(30));
      job.setInputFormat(SequenceFileInputFormat.class);
      job.setInputKeyClass(LongWritable.class);
      job.setInputValueClass(Text.class);
      assertTrue(job.waitForCompletion(true));

      verifyResult();
    } finally {
      deleteTempDirs();
    }
View Full Code Here

Examples of org.apache.hama.graph.GraphJob

      HamaConfiguration conf = new HamaConfiguration();
      conf.setInt(semiClusterMaximumVertexCount, 100);
      conf.setInt(graphJobMessageSentCount, 100);
      conf.setInt(graphJobVertexMaxClusterCount, 1);
      GraphJob semiClusterJob = new GraphJob(conf, SemiClusterJobDriver.class);
      semiClusterJob.setMaxIteration(15);
     
      semiClusterJob.setCompressionCodec(SnappyCompressor.class);
      semiClusterJob.setCompressionThreshold(10);
     
      semiClusterJob
          .setVertexOutputWriterClass(SemiClusterVertexOutputWriter.class);
      semiClusterJob.setJobName("SemiClusterJob");
      semiClusterJob.setVertexClass(SemiClusteringVertex.class);
      semiClusterJob.setInputPath(new Path(INPUT));
      semiClusterJob.setOutputPath(new Path(OUTPUT));
      semiClusterJob.set("hama.graph.self.ref", "true");
      semiClusterJob.setVertexIDClass(Text.class);
      semiClusterJob.setVertexValueClass(SemiClusterMessage.class);
      semiClusterJob.setEdgeValueClass(DoubleWritable.class);
      semiClusterJob.setInputKeyClass(LongWritable.class);
      semiClusterJob.setInputValueClass(Text.class);
      semiClusterJob.setInputFormat(TextInputFormat.class);
      semiClusterJob.setVertexInputReaderClass(SemiClusterTextReader.class);
      semiClusterJob.setPartitioner(HashPartitioner.class);
      semiClusterJob.setOutputFormat(TextOutputFormat.class);
      semiClusterJob.setOutputKeyClass(Text.class);
      semiClusterJob.setOutputValueClass(Text.class);
      semiClusterJob.setNumBspTask(3);
      long startTime = System.currentTimeMillis();
      if (semiClusterJob.waitForCompletion(true)) {
        System.out.println("Job Finished in "
            + (System.currentTimeMillis() - startTime) / 1000.0 + " seconds");
      }
      semiClusterOutputChecker();
    } finally {
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 graphJob = createJob(args, conf);
    long startTime = System.currentTimeMillis();
    if (graphJob.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

    // NOTE: Graph modification APIs can be used only with MapVerticesInfo.
    conf.set("hama.graph.vertices.info",
        "org.apache.hama.graph.MapVerticesInfo");

    GraphJob graphJob = new GraphJob(conf, DynamicGraph.class);
    graphJob.setJobName("Dynamic Graph");
    graphJob.setVertexClass(GraphVertex.class);

    graphJob.setInputPath(new Path(args[0]));
    graphJob.setOutputPath(new Path(args[1]));

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

    graphJob.setInputFormat(TextInputFormat.class);

    graphJob.setVertexInputReaderClass(GraphTextReader.class);
    graphJob.setPartitioner(HashPartitioner.class);

    graphJob.setOutputFormat(TextOutputFormat.class);
    graphJob.setOutputKeyClass(Text.class);
    graphJob.setOutputValueClass(IntWritable.class);

    return graphJob;
  }
View Full Code Here

Examples of org.apache.hama.graph.GraphJob

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

    // Graph job configuration
    HamaConfiguration conf = new HamaConfiguration();
    GraphJob ssspJob = new GraphJob(conf, SSSP.class);
    // Set the job name
    ssspJob.setJobName("Single Source Shortest Path");

    conf.set(START_VERTEX, args[0]);
    ssspJob.setInputPath(new Path(args[1]));
    ssspJob.setOutputPath(new Path(args[2]));

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

    ssspJob.setVertexClass(ShortestPathVertex.class);
    ssspJob.setCombinerClass(MinIntCombiner.class);
    ssspJob.setInputFormat(TextInputFormat.class);
    ssspJob.setInputKeyClass(LongWritable.class);
    ssspJob.setInputValueClass(Text.class);

    ssspJob.setPartitioner(HashPartitioner.class);
    ssspJob.setOutputFormat(TextOutputFormat.class);
    ssspJob.setVertexInputReaderClass(SSSPTextReader.class);
    ssspJob.setOutputKeyClass(Text.class);
    ssspJob.setOutputValueClass(IntWritable.class);
    // Iterate until all the nodes have been reached.
    ssspJob.setMaxIteration(Integer.MAX_VALUE);

    ssspJob.setVertexIDClass(Text.class);
    ssspJob.setVertexValueClass(IntWritable.class);
    ssspJob.setEdgeValueClass(IntWritable.class);

    long startTime = System.currentTimeMillis();
    if (ssspJob.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

  private static final String graphJobMessageSentCount = "semicluster.max.message.sent.count";
  private static final String graphJobVertexMaxClusterCount = "vertex.max.cluster.count";

  public static void startTask(HamaConfiguration conf) throws IOException,
      InterruptedException, ClassNotFoundException {
    GraphJob semiClusterJob = new GraphJob(conf, SemiClusterJobDriver.class);
    // 80,887,377
    semiClusterJob.setCompressionCodec(SnappyCompressor.class);
    semiClusterJob.setCompressionThreshold(10);
   
    semiClusterJob
        .setVertexOutputWriterClass(SemiClusterVertexOutputWriter.class);
    semiClusterJob.setJobName("SemiClusterJob");
    semiClusterJob.setVertexClass(SemiClusteringVertex.class);
    semiClusterJob.setInputPath(new Path(conf.get(inputPathString)));
    semiClusterJob.setOutputPath(new Path(conf.get(outputPathString)));

    semiClusterJob.set("hama.graph.self.ref", "true");
    semiClusterJob.set("hama.graph.repair", "true");

    semiClusterJob.setVertexIDClass(Text.class);
    semiClusterJob.setVertexValueClass(SemiClusterMessage.class);
    semiClusterJob.setEdgeValueClass(DoubleWritable.class);

    semiClusterJob.setInputKeyClass(LongWritable.class);
    semiClusterJob.setInputValueClass(Text.class);
    semiClusterJob.setInputFormat(TextInputFormat.class);
    semiClusterJob.setVertexInputReaderClass(SemiClusterTextReader.class);

    semiClusterJob.setPartitioner(HashPartitioner.class);

    semiClusterJob.setOutputFormat(TextOutputFormat.class);
    semiClusterJob.setOutputKeyClass(Text.class);
    semiClusterJob.setOutputValueClass(Text.class);

    long startTime = System.currentTimeMillis();
    if (semiClusterJob.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);

    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
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.