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


Java GiraphConfiguration.setVertexInputFormatClass方法代码示例

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


在下文中一共展示了GiraphConfiguration.setVertexInputFormatClass方法的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: setupHiveInputs

import org.apache.giraph.conf.GiraphConfiguration; //导入方法依赖的package包/类
/**
 * Initialize hive input settings
 *
 * @param conf Configuration to write to
 * @throws TException thrift problem
 */
private void setupHiveInputs(GiraphConfiguration conf) throws TException {
  if (hiveToVertexClass != null) {
    hiveVertexInputDescription.setNumSplits(HIVE_VERTEX_SPLITS.get(conf));
    HiveApiInputFormat.setProfileInputDesc(conf, hiveVertexInputDescription,
        VERTEX_INPUT_PROFILE_ID);
    conf.setVertexInputFormatClass(HiveVertexInputFormat.class);
    HiveTableSchemas.put(conf, VERTEX_INPUT_PROFILE_ID,
        hiveVertexInputDescription.hiveTableName());
  }

  if (hiveToEdgeClass != null) {
    hiveEdgeInputDescription.setNumSplits(HIVE_EDGE_SPLITS.get(conf));
    HiveApiInputFormat.setProfileInputDesc(conf, hiveEdgeInputDescription,
        EDGE_INPUT_PROFILE_ID);
    conf.setEdgeInputFormatClass(HiveEdgeInputFormat.class);
    HiveTableSchemas.put(conf, EDGE_INPUT_PROFILE_ID,
        hiveEdgeInputDescription.hiveTableName());
  }
}
 
开发者ID:zfighter,项目名称:giraph-research,代码行数:26,代码来源:HiveGiraphRunner.java

示例4: testGetsCalled

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

  String[] graph = new String[] { "1", "2", "3" };

  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);
  assertEquals(8, Obs.postSuperstep);
  assertEquals(2, Obs.postApp);
}
 
开发者ID:zfighter,项目名称:giraph-research,代码行数:26,代码来源:TestMasterObserver.java

示例5: testBspMasterCompute

import org.apache.giraph.conf.GiraphConfiguration; //导入方法依赖的package包/类
/**
 * Run a sample BSP job locally and test MasterCompute.
 *
 * @throws IOException
 * @throws ClassNotFoundException
 * @throws InterruptedException
 */
@Test
public void testBspMasterCompute()
    throws IOException, InterruptedException, ClassNotFoundException {
  GiraphConfiguration conf = new GiraphConfiguration();
  conf.setVertexClass(SimpleMasterComputeVertex.class);
  conf.setVertexInputFormatClass(SimplePageRankVertexInputFormat.class);
  conf.setMasterComputeClass(
      SimpleMasterComputeVertex.SimpleMasterCompute.class);
  conf.setWorkerContextClass(
      SimpleMasterComputeVertex.SimpleMasterComputeWorkerContext.class);
  GiraphJob job = prepareJob(getCallingMethodName(), conf);
  assertTrue(job.run(true));
  if (!runningInDistributedMode()) {
    double finalSum =
        SimpleMasterComputeVertex.SimpleMasterComputeWorkerContext.getFinalSum();
    System.out.println("testBspMasterCompute: finalSum=" + finalSum);
    assertEquals(32.5, finalSum, 0d);
  }
}
 
开发者ID:zfighter,项目名称:giraph-research,代码行数:27,代码来源:TestBspBasic.java

示例6: 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

示例7: 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

示例8: 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

示例9: 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

示例10: 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

示例11: 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

示例12: getConfiguration

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

示例13: getConfiguration

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

示例14: setUp

import org.apache.giraph.conf.GiraphConfiguration; //导入方法依赖的package包/类
@Before
public void setUp() {
    giraphConf = new GiraphConfiguration();
    giraphConf.setComputationClass(LeafCompressionComputation.class);
    giraphConf.setVertexInputFormatClass(InMemoryVertexInputFormat.class);
    giraphConf.setVertexOutputFormatClass(InMemoryVertexOutputFormat.class);
}
 
开发者ID:Sotera,项目名称:distributed-graph-analytics,代码行数:8,代码来源:LeafCompressionComputationTest.java

示例15: testToyData

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

  // A small graph
  String[] graph = new String[] {
    "1 4 2 3",
    "2 1",
    "4 3 2",
    "5 2 4"
  };

  GiraphConfiguration conf = new GiraphConfiguration();
  conf.setInt(RandomWalkWithRestartComputation.MAX_SUPERSTEPS, 50);
  conf.setFloat(
      RandomWalkWithRestartComputation.TELEPORTATION_PROBABILITY, 0.15f);
  conf.setComputationClass(PageRankComputation.class);
  conf.setOutEdgesClass(ByteArrayEdges.class);
  conf.setVertexInputFormatClass(LongDoubleNullTextInputFormat.class);
  conf.setVertexOutputFormatClass(
      VertexWithDoubleValueNullEdgeTextOutputFormat.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);

  assertEquals(0.28159076008518047, steadyStateProbabilities.get(1l),
      RandomWalkTestUtils.EPSILON);
  assertEquals(0.2514648601529863, steadyStateProbabilities.get(2l),
      RandomWalkTestUtils.EPSILON);
  assertEquals(0.22262961972286327, steadyStateProbabilities.get(3l),
      RandomWalkTestUtils.EPSILON);
  assertEquals(0.17646783276703806, steadyStateProbabilities.get(4l),
      RandomWalkTestUtils.EPSILON);
  assertEquals(0.06784692727193153, steadyStateProbabilities.get(5l),
      RandomWalkTestUtils.EPSILON);
}
 
开发者ID:renato2099,项目名称:giraph-gora,代码行数:43,代码来源:PageRankComputationTest.java


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