Examples of GiraphConfiguration


Examples of org.apache.giraph.conf.GiraphConfiguration

    }
  }

  @Before
  public void setUp() {
    GiraphConfiguration giraphConfiguration = new GiraphConfiguration();
    giraphConfiguration.setVertexClass(DummyVertex.class);
    conf = new ImmutableClassesGiraphConfiguration<Text, DoubleWritable,
        Writable, Writable>(giraphConfiguration);
  }
View Full Code Here

Examples of org.apache.giraph.conf.GiraphConfiguration

                "10 7 8 11",
                "11 7 10",

                "9" };

        GiraphConfiguration conf = new GiraphConfiguration();
        conf.setVertexClass(ConnectedComponentsVertex.class);
        conf.setOutEdgesClass(ByteArrayEdges.class);
        conf.setCombinerClass(MinimumIntCombiner.class);
        conf.setVertexInputFormatClass(IntIntNullTextInputFormat.class);
        conf.setVertexOutputFormatClass(IdWithValueTextOutputFormat.class);

        // run internally
        Iterable<String> results = InternalVertexRunner.run(conf, graph);

        SetMultimap<Integer,Integer> components = parseResults(results);
View Full Code Here

Examples of org.apache.giraph.conf.GiraphConfiguration

  @Before
  public void setUp() throws IOException, InterruptedException {
    rr = mock(RecordReader.class);
    when(rr.nextKeyValue()).thenReturn(true);
    GiraphConfiguration giraphConf = new GiraphConfiguration();
    giraphConf.setVertexClass(DummyVertex.class);
    conf = new ImmutableClassesGiraphConfiguration<LongWritable, DoubleWritable,
        DoubleWritable, Writable>(giraphConf);
    graphState = mock(GraphState.class);
    tac = mock(TaskAttemptContext.class);
    when(tac.getConfiguration()).thenReturn(conf);
View Full Code Here

Examples of org.apache.giraph.conf.GiraphConfiguration

  /**
   * A local integration test on toy data
   */
  @Test
  public void testToyData() throws Exception {
    GiraphConfiguration conf = new GiraphConfiguration();
    conf.setVertexClass(ConnectedComponentsVertex.class);
    conf.setOutEdgesClass(ByteArrayEdges.class);
    conf.setCombinerClass(MinimumIntCombiner.class);

    TestGraph<IntWritable, IntWritable, NullWritable, IntWritable> graph =
      new TestGraph<IntWritable, IntWritable, NullWritable, IntWritable> (conf);
    // a small graph with three components
    graph.addVertex(new IntWritable(1), new IntWritable(1), makeEdges(2, 3))
View Full Code Here

Examples of org.apache.giraph.conf.GiraphConfiguration

    }
  }

  @Before
  public void setUp() {
    GiraphConfiguration tmpConfig = new GiraphConfiguration();
    tmpConfig.setVertexClass(IntVertex.class);
    GiraphConstants.AUTHENTICATE.set(tmpConfig, true);
    conf = new ImmutableClassesGiraphConfiguration(tmpConfig);
  }
View Full Code Here

Examples of org.apache.giraph.conf.GiraphConfiguration

  @Test
  public void testToyData() throws Exception {
    // A small graph
    String[] graph = new String[] { "12 34 56", "34 78", "56 34 78", "78 34" };

    GiraphConfiguration conf = new GiraphConfiguration();
    conf.setInt(RandomWalkWithRestartVertex.SOURCE_VERTEX, 12);
    conf.setInt(RandomWalkWithRestartVertex.MAX_SUPERSTEPS, 30);
    conf.setFloat(RandomWalkWithRestartVertex.TELEPORTATION_PROBABILITY, 0.25f);
    conf.setVertexClass(RandomWalkWithRestartVertex.class);
    conf.setOutEdgesClass(ByteArrayEdges.class);
    conf.setVertexInputFormatClass(LongDoubleDoubleTextInputFormat.class);
    conf.setVertexOutputFormatClass(
        VertexWithDoubleValueDoubleEdgeTextOutputFormat.class);
    conf.setWorkerContextClass(RandomWalkWorkerContext.class);
    conf.setMasterComputeClass(RandomWalkVertexMasterCompute.class);
    // Run internally
    Iterable<String> results = InternalVertexRunner.run(conf, graph);

    Map<Long, Double> steadyStateProbabilities =
        RandomWalkTestUtils.parseSteadyStateProbabilities(results);
View Full Code Here

Examples of org.apache.giraph.conf.GiraphConfiguration

    String klasses[] = new String[] {
        Obs.class.getName(),
        Obs.class.getName()
    };

    GiraphConfiguration conf = new GiraphConfiguration();
    conf.set(GiraphConstants.MASTER_OBSERVER_CLASSES.getKey(),
        arrayToString(klasses));
    conf.setVertexClass(NoOpVertex.class);
    conf.setOutEdgesClass(ByteArrayEdges.class);
    conf.setVertexInputFormatClass(IntNullNullTextInputFormat.class);
    InternalVertexRunner.run(conf, graph);

    assertEquals(2, Obs.preApp);
    // 3 supersteps + 1 input superstep * 2 observers = 8 callbacks
    assertEquals(8, Obs.preSuperstep);
View Full Code Here

Examples of org.apache.giraph.conf.GiraphConfiguration

  @Test
  public void testContinue()
      throws IOException, InterruptedException, ClassNotFoundException {

    Path outputPath = getTempPath(getCallingMethodName());
    GiraphConfiguration conf = new GiraphConfiguration();
    conf.setVertexClass(WeightedPageRankVertex.class);
    conf.setVertexInputFormatClass(PseudoRandomVertexInputFormat.class);
    conf.setVertexOutputFormatClass(JsonBase64VertexOutputFormat.class);
    GiraphJob job = prepareJob(getCallingMethodName(), conf, outputPath);
    job.getConfiguration().setLong(
        PseudoRandomInputFormatConstants.AGGREGATE_VERTICES, 101);
    job.getConfiguration().setLong(
        PseudoRandomInputFormatConstants.EDGES_PER_VERTEX, 2);
    job.getConfiguration().setInt(WeightedPageRankVertex.SUPERSTEP_COUNT, 2);

    assertTrue(job.run(true));

    Path outputPath2 = getTempPath(getCallingMethodName() + "2");
    conf = new GiraphConfiguration();
    conf.setVertexClass(WeightedPageRankVertex.class);
    conf.setVertexInputFormatClass(JsonBase64VertexInputFormat.class);
    conf.setVertexOutputFormatClass(JsonBase64VertexOutputFormat.class);
    job = prepareJob(getCallingMethodName(), conf, outputPath2);
    job.getConfiguration().setInt(WeightedPageRankVertex.SUPERSTEP_COUNT, 3);
    GiraphFileInputFormat.addVertexInputPath(
      job.getInternalJob().getConfiguration(), outputPath);
    assertTrue(job.run(true));

    Path outputPath3 = getTempPath(getCallingMethodName() + "3");
    conf = new GiraphConfiguration();
    conf.setVertexClass(WeightedPageRankVertex.class);
    conf.setVertexInputFormatClass(PseudoRandomVertexInputFormat.class);
    conf.setVertexOutputFormatClass(JsonBase64VertexOutputFormat.class);
    job = prepareJob(getCallingMethodName(), conf, outputPath3);
    conf = job.getConfiguration();
    conf.setLong(PseudoRandomInputFormatConstants.AGGREGATE_VERTICES, 101);
    conf.setLong(PseudoRandomInputFormatConstants.EDGES_PER_VERTEX, 2);
    conf.setInt(WeightedPageRankVertex.SUPERSTEP_COUNT, 5);
    assertTrue(job.run(true));

    assertEquals(101, getNumResults(conf, outputPath));
    assertEquals(101, getNumResults(conf, outputPath2));
    assertEquals(101, getNumResults(conf, outputPath3));
View Full Code Here

Examples of org.apache.giraph.conf.GiraphConfiguration

    // A small graph
    String[] graph =
        new String[] { "12 34:0.1 56:0.9", "34 78:0.9 56:0.1",
          "56 12:0.1 34:0.8 78:0.1", "78 34:1.0" };

    GiraphConfiguration conf = new GiraphConfiguration();
    conf.setInt(RandomWalkWithRestartVertex.SOURCE_VERTEX, 12);
    conf.setInt(RandomWalkWithRestartVertex.MAX_SUPERSTEPS, 30);
    conf.setFloat(RandomWalkWithRestartVertex.TELEPORTATION_PROBABILITY, 0.15f);
    conf.setVertexClass(RandomWalkWithRestartVertex.class);
    conf.setOutEdgesClass(ByteArrayEdges.class);
    conf.setVertexInputFormatClass(
        NormalizingLongDoubleDoubleTextInputFormat.class);
    conf.setVertexOutputFormatClass(
        VertexWithDoubleValueDoubleEdgeTextOutputFormat.class);
    conf.setWorkerContextClass(RandomWalkWorkerContext.class);
    conf.setMasterComputeClass(RandomWalkVertexMasterCompute.class);
    // Run internally
    Iterable<String> results = InternalVertexRunner.run(conf, graph);

    Map<Long, Double> steadyStateProbabilities =
        RandomWalkTestUtils.parseSteadyStateProbabilities(results);
View Full Code Here

Examples of org.apache.giraph.conf.GiraphConfiguration

  @Before
  public void prepare() throws IOException {
    directory = Files.createTempDir();

    Configuration.addDefaultResource("giraph-site.xml");
    GiraphConfiguration initConfig = new GiraphConfiguration();
    initConfig.setVertexClass(IntVertex.class);
    GiraphConstants.MESSAGES_DIRECTORY.set(
        initConfig, new File(directory, "giraph_messages").toString());
    config = new ImmutableClassesGiraphConfiguration(initConfig);

    testData = new TestData();
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.