当前位置: 首页>>代码示例>>Java>>正文


Java GiraphConfiguration.setVertexOutputFormatClass方法代码示例

本文整理汇总了Java中org.apache.giraph.conf.GiraphConfiguration.setVertexOutputFormatClass方法的典型用法代码示例。如果您正苦于以下问题:Java GiraphConfiguration.setVertexOutputFormatClass方法的具体用法?Java GiraphConfiguration.setVertexOutputFormatClass怎么用?Java GiraphConfiguration.setVertexOutputFormatClass使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.apache.giraph.conf.GiraphConfiguration的用法示例。


在下文中一共展示了GiraphConfiguration.setVertexOutputFormatClass方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: testMax

import org.apache.giraph.conf.GiraphConfiguration; //导入方法依赖的package包/类
@Test
public void testMax() throws Exception {

    Vertex v1 = graph.addVertex(T.id, 1, T.label, "hi");
    Vertex v2 = graph.addVertex(T.id, 2, T.label, "world");
    Vertex v5 = graph.addVertex(T.id, 5, T.label, "bye");
    v5.addEdge("e", v1);
    v1.addEdge("e", v5);
    v1.addEdge("e", v2);
    v2.addEdge("e", v5);

    HBaseGraphConfiguration hconf = graph.configuration();
    GiraphConfiguration conf = new GiraphConfiguration(hconf.toHBaseConfiguration());
    conf.setComputationClass(MaxComputation.class);
    conf.setEdgeInputFormatClass(HBaseEdgeInputFormat.class);
    conf.setVertexInputFormatClass(HBaseVertexInputFormat.class);
    conf.setVertexOutputFormatClass(IdWithValueTextOutputFormat.class);

    Iterable<String> results = InternalHBaseVertexRunner.run(conf);

    Map<Integer, Integer> values = parseResults(results);
    assertEquals(3, values.size());
    assertEquals(5, (int) values.get(1));
    assertEquals(5, (int) values.get(2));
    assertEquals(5, (int) values.get(5));
}
 
开发者ID:rayokota,项目名称:hgraphdb,代码行数:27,代码来源:MaxComputationTest.java

示例2: testMax

import org.apache.giraph.conf.GiraphConfiguration; //导入方法依赖的package包/类
@Test
public void testMax() throws Exception {
    HBaseGraphConfiguration hconf = graph.configuration();

    GiraphConfiguration conf = new GiraphConfiguration(hconf.toHBaseConfiguration());
    conf.setComputationClass(MaxComputation.class);
    conf.setEdgeInputFormatClass(HBaseEdgeInputFormat.class);
    conf.setVertexInputFormatClass(HBaseVertexInputFormat.class);
    conf.setEdgeOutputFormatClass(CreateEdgeOutputFormat.class);
    conf.setVertexOutputFormatClass(MaxPropertyVertexOutputFormat.class);

    Vertex v1 = graph.addVertex(T.id, 1, T.label, "hi");
    Vertex v2 = graph.addVertex(T.id, 2, T.label, "world");
    Vertex v5 = graph.addVertex(T.id, 5, T.label, "bye");
    v5.addEdge("e", v1);
    v1.addEdge("e", v5);
    v1.addEdge("e", v2);
    v2.addEdge("e", v5);

    InternalHBaseVertexRunner.run(conf);

    graph.vertices().forEachRemaining(v -> assertEquals(5, v.property("max").value()));
    assertEquals(4, IteratorUtils.count(IteratorUtils.filter(graph.edges(), e -> e.label().equals("e2"))));
}
 
开发者ID:rayokota,项目名称:hgraphdb,代码行数:25,代码来源:MaxComputationWithGraphOutputTest.java

示例3: testComputeOutput

import org.apache.giraph.conf.GiraphConfiguration; //导入方法依赖的package包/类
@Test
public void testComputeOutput() throws Exception {
    GiraphConfiguration conf = new GiraphConfiguration();
    conf.setComputationClass(WeaklyConnectedComponentComputation.class);
    conf.setVertexOutputFormatClass(InMemoryVertexOutputFormat.class);
    TestGraph<Text,Text,Text> testGraph = getGraph(conf);
    InMemoryVertexOutputFormat.initializeOutputGraph(conf);
    InternalVertexRunner.run(conf, testGraph);
    TestGraph<Text, Text, Text> graph = InMemoryVertexOutputFormat.getOutputGraph();
    assertEquals(6, graph.getVertices().size());
    assertEquals("2", graph.getVertex(new Text("1")).getValue().toString());
    assertEquals("2", graph.getVertex(new Text("2")).getValue().toString());
    assertEquals("4", graph.getVertex(new Text("3")).getValue().toString());
    assertEquals("4", graph.getVertex(new Text("4")).getValue().toString());
    assertEquals("6", graph.getVertex(new Text("5")).getValue().toString());
    assertEquals("6", graph.getVertex(new Text("6")).getValue().toString());
}
 
开发者ID:Sotera,项目名称:distributed-graph-analytics,代码行数:18,代码来源:WeaklyConnectedComponentComputationTest.java

示例4: testBspSuperStep

import org.apache.giraph.conf.GiraphConfiguration; //导入方法依赖的package包/类
/**
 * Run a sample BSP job locally and test supersteps.
 *
 * @throws IOException
 * @throws ClassNotFoundException
 * @throws InterruptedException
 */
@Test
public void testBspSuperStep()
    throws IOException, InterruptedException, ClassNotFoundException {
  String callingMethod = getCallingMethodName();
  Path outputPath = getTempPath(callingMethod);
  GiraphConfiguration conf = new GiraphConfiguration();
  conf.setVertexClass(SimpleSuperstepVertex.class);
  conf.setVertexInputFormatClass(SimpleSuperstepVertexInputFormat.class);
  conf.setVertexOutputFormatClass(SimpleSuperstepVertexOutputFormat.class);
  GiraphJob job = prepareJob(callingMethod, conf, outputPath);
  Configuration configuration = job.getConfiguration();
  // GeneratedInputSplit will generate 10 vertices
  configuration.setLong(GeneratedVertexReader.READER_VERTICES, 10);
  assertTrue(job.run(true));
  if (!runningInDistributedMode()) {
    FileStatus fileStatus = getSinglePartFileStatus(configuration, outputPath);
    assertEquals(49l, fileStatus.getLen());
  }
}
 
开发者ID:zfighter,项目名称:giraph-research,代码行数:27,代码来源:TestBspBasic.java

示例5: testMaxSuperstep

import org.apache.giraph.conf.GiraphConfiguration; //导入方法依赖的package包/类
/**
 * Run a job that tests that this job completes in the desired number of
 * supersteps
 *
 * @throws java.io.IOException
 * @throws ClassNotFoundException
 * @throws InterruptedException
 */
@Test
public void testMaxSuperstep()
        throws IOException, InterruptedException, ClassNotFoundException {
  GiraphConfiguration conf = new GiraphConfiguration();
  conf.setVertexClass(InfiniteLoopVertex.class);
  conf.setVertexInputFormatClass(SimplePageRankVertexInputFormat.class);
  conf.setVertexOutputFormatClass(SimplePageRankVertexOutputFormat.class);
  GiraphJob job = prepareJob(getCallingMethodName(), conf,
      getTempPath(getCallingMethodName()));
  job.getConfiguration().setMaxNumberOfSupersteps(3);
  assertTrue(job.run(true));
  if (!runningInDistributedMode()) {
    GiraphHadoopCounter superstepCounter =
        GiraphStats.getInstance().getSuperstepCounter();
    assertEquals(superstepCounter.getValue(), 3L);
  }
}
 
开发者ID:zfighter,项目名称:giraph-research,代码行数:26,代码来源:TestMaxSuperstep.java

示例6: testEdgesOnlyWithReverse

import org.apache.giraph.conf.GiraphConfiguration; //导入方法依赖的package包/类
@Test
public void testEdgesOnlyWithReverse() throws Exception {
  String[] edges = new String[] {
      "1 2",
      "2 3",
      "2 4",
      "4 1"
  };

  GiraphConfiguration conf = new GiraphConfiguration();
  conf.setVertexClass(TestVertexWithNumEdges.class);
  conf.setOutEdgesClass(ByteArrayEdges.class);
  conf.setEdgeInputFormatClass(IntNullReverseTextEdgeInputFormat.class);
  conf.setVertexOutputFormatClass(IdWithValueTextOutputFormat.class);
  Iterable<String> results = InternalVertexRunner.run(conf, null, edges);

  Map<Integer, Integer> values = parseResults(results);

  // Check that all vertices with outgoing edges have been created
  assertEquals(4, values.size());
  // Check the number of edges for each vertex
  assertEquals(2, (int) values.get(1));
  assertEquals(3, (int) values.get(2));
  assertEquals(1, (int) values.get(3));
  assertEquals(2, (int) values.get(4));
}
 
开发者ID:zfighter,项目名称:giraph-research,代码行数:27,代码来源:TestEdgeInput.java

示例7: testEdgesOnly

import org.apache.giraph.conf.GiraphConfiguration; //导入方法依赖的package包/类
@Test
public void testEdgesOnly() throws Exception {
  String[] edges = new String[] {
      "1 2",
      "2 3",
      "2 4",
      "4 1"
  };

  GiraphConfiguration conf = new GiraphConfiguration();
  conf.setVertexClass(TestVertexWithNumEdges.class);
  conf.setOutEdgesClass(ByteArrayEdges.class);
  conf.setEdgeInputFormatClass(IntNullTextEdgeInputFormat.class);
  conf.setVertexOutputFormatClass(IdWithValueTextOutputFormat.class);
  Iterable<String> results = InternalVertexRunner.run(conf, null, edges);

  Map<Integer, Integer> values = parseResults(results);

  // Check that all vertices with outgoing edges have been created
  assertEquals(3, values.size());
  // Check the number of edges for each vertex
  assertEquals(1, (int) values.get(1));
  assertEquals(2, (int) values.get(2));
  assertEquals(1, (int) values.get(4));
}
 
开发者ID:zfighter,项目名称:giraph-research,代码行数:26,代码来源:TestEdgeInput.java

示例8: testBspShortestPaths

import org.apache.giraph.conf.GiraphConfiguration; //导入方法依赖的package包/类
/**
 * Run a sample BSP job locally and test shortest paths.
 *
 * @throws IOException
 * @throws ClassNotFoundException
 * @throws InterruptedException
 */
@Test
public void testBspShortestPaths()
    throws IOException, InterruptedException, ClassNotFoundException {
  Path outputPath = getTempPath(getCallingMethodName());
  GiraphConfiguration conf = new GiraphConfiguration();
  conf.setComputationClass(SimpleShortestPathsComputation.class);
  conf.setVertexInputFormatClass(SimplePageRankVertexInputFormat.class);
  conf.setVertexOutputFormatClass(
      JsonLongDoubleFloatDoubleVertexOutputFormat.class);
  SimpleShortestPathsComputation.SOURCE_ID.set(conf, 0);
  GiraphJob job = prepareJob(getCallingMethodName(), conf, outputPath);

  assertTrue(job.run(true));

  int numResults = getNumResults(job.getConfiguration(), outputPath);

  int expectedNumResults = runningInDistributedMode() ? 15 : 5;
  assertEquals(expectedNumResults, numResults);
}
 
开发者ID:renato2099,项目名称:giraph-gora,代码行数:27,代码来源:TestBspBasic.java

示例9: testCheckJobThrows

import org.apache.giraph.conf.GiraphConfiguration; //导入方法依赖的package包/类
@Test
public void testCheckJobThrows() throws Exception {
  String tableName = "test1";
  hiveServer.createTable("CREATE TABLE " + tableName +
      " (i1 BIGINT, i2 INT) " +
      " ROW FORMAT DELIMITED FIELDS TERMINATED BY '\t'");
  String[] rows = {
      "1\t2",
      "2\t3",
      "2\t4",
      "4\t1",
  };
  hiveServer.loadData(tableName, rows);

  GiraphConfiguration conf = new GiraphConfiguration();
  HIVE_EDGE_INPUT.setTable(conf, tableName);
  HIVE_EDGE_INPUT.setClass(conf, HiveIntNullEdge.class);
  conf.setComputationClass(ComputationCountEdges.class);
  conf.setEdgeInputFormatClass(HiveEdgeInputFormat.class);
  conf.setVertexOutputFormatClass(IdWithValueTextOutputFormat.class);
  assertNull(InternalVertexRunner.run(conf, new String[0], new String[0]));
}
 
开发者ID:renato2099,项目名称:giraph-gora,代码行数:23,代码来源:CheckInputTest.java

示例10: testBspShortestPaths

import org.apache.giraph.conf.GiraphConfiguration; //导入方法依赖的package包/类
/**
 * Run a sample BSP job locally and test shortest paths.
 *
 * @throws IOException
 * @throws ClassNotFoundException
 * @throws InterruptedException
 */
@Test
public void testBspShortestPaths()
    throws IOException, InterruptedException, ClassNotFoundException {
  Path outputPath = getTempPath(getCallingMethodName());
  GiraphConfiguration conf = new GiraphConfiguration();
  conf.setVertexClass(SimpleShortestPathsVertex.class);
  conf.setVertexInputFormatClass(SimplePageRankVertexInputFormat.class);
  conf.setVertexOutputFormatClass(
      JsonLongDoubleFloatDoubleVertexOutputFormat.class);
  SimpleShortestPathsVertex.SOURCE_ID.set(conf, 0);
  GiraphJob job = prepareJob(getCallingMethodName(), conf, outputPath);

  assertTrue(job.run(true));

  int numResults = getNumResults(job.getConfiguration(), outputPath);

  int expectedNumResults = runningInDistributedMode() ? 15 : 5;
  assertEquals(expectedNumResults, numResults);
}
 
开发者ID:zfighter,项目名称:giraph-research,代码行数:27,代码来源:TestBspBasic.java

示例11: testToyData

import org.apache.giraph.conf.GiraphConfiguration; //导入方法依赖的package包/类
/**
 * A local integration test on toy data
 */
@Test
public void testToyData() throws Exception {

    Vertex v1 = graph.addVertex(T.id, 1);
    Vertex v2 = graph.addVertex(T.id, 2);
    Vertex v3 = graph.addVertex(T.id, 3);
    Vertex v4 = graph.addVertex(T.id, 4);
    v1.addEdge("e", v2, "weight", 1.0);
    v1.addEdge("e", v3, "weight", 3.0);
    v2.addEdge("e", v3, "weight", 1.0);
    v2.addEdge("e", v4, "weight", 10.0);
    v3.addEdge("e", v4, "weight", 2.0);

    HBaseGraphConfiguration hconf = graph.configuration();
    GiraphConfiguration conf = new GiraphConfiguration(hconf.toHBaseConfiguration());
    // start from vertex 1
    SOURCE_ID.set(conf, 1);
    conf.setComputationClass(SimpleShortestPathsComputation.class);
    conf.setEdgeInputFormatClass(HBaseEdgeInputFormat.class);
    conf.setVertexInputFormatClass(HBaseVertexInputFormat.class);
    conf.setVertexOutputFormatClass(VertexWithDoubleValueNullEdgeTextOutputFormat.class);

    // run internally
    Iterable<String> results = InternalHBaseVertexRunner.run(conf);

    Map<Long, Double> distances = parseDistances(results);

    // verify results
    assertNotNull(distances);
    assertEquals(4, distances.size());
    assertEquals(0.0, distances.get(1L), 0d);
    assertEquals(1.0, distances.get(2L), 0d);
    assertEquals(2.0, distances.get(3L), 0d);
    assertEquals(4.0, distances.get(4L), 0d);
}
 
开发者ID:rayokota,项目名称:hgraphdb,代码行数:39,代码来源:SimpleShortestPathsComputationTest.java

示例12: run

import org.apache.giraph.conf.GiraphConfiguration; //导入方法依赖的package包/类
@Override
public int run(String[] args) throws Exception {
    if (args.length != 3) {
        throw new IllegalArgumentException(
            "Syntax error: Must have 3 arguments <numbersOfWorkers> <inputLocaiton> <outputLocation>");
    }

    int numberOfWorkers = Integer.parseInt(args[0]);
    String inputLocation = args[1];
    String outputLocation = args[2];

    GiraphJob job = new GiraphJob(getConf(), getClass().getName());
    GiraphConfiguration gconf = job.getConfiguration();
    gconf.setWorkerConfiguration(numberOfWorkers, numberOfWorkers, 100.0f);

    GiraphFileInputFormat.addVertexInputPath(gconf, new Path(inputLocation));
    FileOutputFormat.setOutputPath(job.getInternalJob(), new Path(outputLocation));

    gconf.setComputationClass(ZombieComputation.class);
    gconf.setMasterComputeClass(ZombieMasterCompute.class);
    gconf.setVertexInputFormatClass(ZombieTextVertexInputFormat.class);
    gconf.setVertexOutputFormatClass(ZombieTextVertexOutputFormat.class);
    gconf.setWorkerContextClass(ZombieWorkerContext.class);

    boolean verbose = true;
    if (job.run(verbose)) {
        return 0;
    } else {
        return -1;
    }
}
 
开发者ID:amitchmca,项目名称:hadooparchitecturebook,代码行数:32,代码来源:ZombieBiteJob.java

示例13: getConfiguration

import org.apache.giraph.conf.GiraphConfiguration; //导入方法依赖的package包/类
private GiraphConfiguration getConfiguration() {
  GiraphConfiguration conf = new GiraphConfiguration();
  conf.setComputationClass(DiffusionComputation.class);
  conf.setMasterComputeClass(DiffusionMasterComputation.class);
  conf.setVertexInputFormatClass(DiffusionTextVertexInputFormat.class);
  conf.setVertexOutputFormatClass(DiffusionTextVertexOutputFormat.class);
  conf.setBoolean(DiffusionTextVertexOutputFormat.TEST_OUTPUT, true);
  return conf;
}
 
开发者ID:galpha,项目名称:giraph-didic,代码行数:10,代码来源:DiffusionComputationTest.java

示例14: testRyaInput

import org.apache.giraph.conf.GiraphConfiguration; //导入方法依赖的package包/类
@Test
public void testRyaInput() throws Exception {

    AccumuloRdfConfiguration conf = getConf();
    AccumuloRyaDAO ryaDAO = RyaSailFactory.getAccumuloDAO(conf);

    ryaDAO.add(new RyaStatement(new RyaURI("urn:test#1234"),
            new RyaURI("urn:test#pred1"),
            new RyaURI("urn:test#obj1")));
    ryaDAO.add(new RyaStatement(new RyaURI("urn:test#1234"),
            new RyaURI("urn:test#pred2"),
            new RyaURI("urn:test#obj2")));
    ryaDAO.add(new RyaStatement(new RyaURI("urn:test#1234"),
            new RyaURI("urn:test#pred3"),
            new RyaURI("urn:test#obj3")));
    ryaDAO.add(new RyaStatement(new RyaURI("urn:test#1234"),
            new RyaURI("urn:test#pred4"),
            new RyaURI("urn:test#obj4")));
    ryaDAO.flush();

    GiraphJob job = new GiraphJob(conf, getCallingMethodName());

    setupConfiguration(job);
    GiraphConfiguration giraphConf = job.getConfiguration();
    giraphConf.setComputationClass(EdgeNotification.class);
    giraphConf.setVertexInputFormatClass(RyaVertexInputFormat.class);
    giraphConf.setVertexOutputFormatClass(TestTextOutputFormat.class);


    if (log.isInfoEnabled())
        log.info("Running edge notification job using Rya Vertex input");

}
 
开发者ID:apache,项目名称:incubator-rya,代码行数:34,代码来源:TestVertexFormat.java

示例15: getConfiguration

import org.apache.giraph.conf.GiraphConfiguration; //导入方法依赖的package包/类
private GiraphConfiguration getConfiguration() {
  GiraphConfiguration conf = new GiraphConfiguration();
  conf.setComputationClass(ARPComputation.class);
  conf.setMasterComputeClass(ARPMasterComputation.class);
  conf.setVertexInputFormatClass(ARPTextVertexInputFormat.class);
  conf.setVertexOutputFormatClass(ARPTextVertexOutputFormat.class);
  return conf;
}
 
开发者ID:dbs-leipzig,项目名称:giraph-algorithms,代码行数:9,代码来源:ARPComputationTest.java


注:本文中的org.apache.giraph.conf.GiraphConfiguration.setVertexOutputFormatClass方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。