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


Java GiraphConfiguration类代码示例

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


GiraphConfiguration类属于org.apache.giraph.conf包,在下文中一共展示了GiraphConfiguration类的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: run

import org.apache.giraph.conf.GiraphConfiguration; //导入依赖的package包/类
@Override
public int run(String[] args) throws Exception {
	if (null == getConf()) {
		conf = new Configuration();
	}
	GiraphConfiguration giraphConf = new GiraphConfiguration(getConf());
	CommandLine cmd = ConfigurationUtils.parseArgs(giraphConf, args);

	if (null == cmd) {
		return 0;
	}
	final String vertexClassName = args[0];
	final String jobName = "Giraph: " + vertexClassName;

	GiraphJob job = new GiraphJob(giraphConf, jobName);
	prepareHadoopMRJob(job, cmd);
	boolean verbose = !cmd.hasOption('q');

	return job.run(verbose) ? 0 : -1;
}
 
开发者ID:tayllan,项目名称:comparative-study-of-frameworks-for-parallel-processing-of-graphs,代码行数:21,代码来源:MeuGiraphRunner.java

示例4: run

import org.apache.giraph.conf.GiraphConfiguration; //导入依赖的package包/类
@Override
public int run(String[] args) throws Exception {
	if (null == getConf()) {
		conf = new Configuration();
	}
	GiraphConfiguration giraphConf = new GiraphConfiguration(getConf());
	CommandLine cmd = ConfigurationUtils.parseArgs(giraphConf, args);

	if (null == cmd) {
		return 0;
	}
	final String vertexClassName = args[0];
	final String jobName = "Giraph: " + vertexClassName;

	giraphConf.setMaxNumberOfSupersteps(MAX_NUMBER_SUPERSTEPS);

	GiraphJob job = new GiraphJob(giraphConf, jobName);
	prepareHadoopMRJob(job, cmd);
	boolean verbose = !cmd.hasOption('q');

	return job.run(verbose) ? 0 : -1;
}
 
开发者ID:tayllan,项目名称:comparative-study-of-frameworks-for-parallel-processing-of-graphs,代码行数:23,代码来源:MeuGiraphRunner.java

示例5: testEqualPageRankForSevenNodes

import org.apache.giraph.conf.GiraphConfiguration; //导入依赖的package包/类
@Test
public void testEqualPageRankForSevenNodes() throws Exception {
    GiraphConfiguration conf = getConf();
    TestGraph<Text, DoubleWritable, Text> input = getTestGraph(conf);
    InMemoryVertexOutputFormat.initializeOutputGraph(conf);
    InternalVertexRunner.run(conf, input);
    TestGraph<Text, DoubleWritable, Text> output = InMemoryVertexOutputFormat.getOutputGraph();
    assertEquals(8, output.getVertices().size());
    assertTrue(output.getVertex(new Text("1")).getValue().get() < output.getVertex(new Text("8")).getValue().get());
    assertTrue(output.getVertex(new Text("1")).getValue().get() < output.getVertex(new Text("7")).getValue().get());
    assertTrue(output.getVertex(new Text("1")).getValue().get() < output.getVertex(new Text("6")).getValue().get());
    assertTrue(output.getVertex(new Text("1")).getValue().get() < output.getVertex(new Text("5")).getValue().get());
    assertTrue(output.getVertex(new Text("1")).getValue().get() < output.getVertex(new Text("4")).getValue().get());
    assertTrue(output.getVertex(new Text("1")).getValue().get() < output.getVertex(new Text("3")).getValue().get());
    assertTrue(output.getVertex(new Text("1")).getValue().get() < output.getVertex(new Text("2")).getValue().get());

}
 
开发者ID:Sotera,项目名称:distributed-graph-analytics,代码行数:18,代码来源:PageRankTest.java

示例6: testHighPageRankForOneNode

import org.apache.giraph.conf.GiraphConfiguration; //导入依赖的package包/类
@Test
public void testHighPageRankForOneNode() throws Exception {
    GiraphConfiguration conf = getConf();
    TestGraph<Text, DoubleWritable, Text> input = getHighPageRankGraph(conf);
    InMemoryVertexOutputFormat.initializeOutputGraph(conf);
    InternalVertexRunner.run(conf, input);
    TestGraph<Text, DoubleWritable, Text> output = InMemoryVertexOutputFormat.getOutputGraph();
    assertEquals(8, output.getVertices().size());
    assertTrue(output.getVertex(new Text("8")).getValue().get() < output.getVertex(new Text("1")).getValue().get());
    assertTrue(output.getVertex(new Text("2")).getValue().get() < output.getVertex(new Text("1")).getValue().get());
    assertTrue(output.getVertex(new Text("3")).getValue().get() < output.getVertex(new Text("1")).getValue().get());
    assertTrue(output.getVertex(new Text("4")).getValue().get() < output.getVertex(new Text("1")).getValue().get());
    assertTrue(output.getVertex(new Text("5")).getValue().get() < output.getVertex(new Text("1")).getValue().get());
    assertTrue(output.getVertex(new Text("6")).getValue().get() < output.getVertex(new Text("1")).getValue().get());
    assertTrue(output.getVertex(new Text("7")).getValue().get() < output.getVertex(new Text("1")).getValue().get());

}
 
开发者ID:Sotera,项目名称:distributed-graph-analytics,代码行数:18,代码来源:PageRankTest.java

示例7: testBiggerGraph

import org.apache.giraph.conf.GiraphConfiguration; //导入依赖的package包/类
@Test
public void testBiggerGraph() throws Exception {
    GiraphConfiguration conf = getConf();
    TestGraph<Text, LouvainNodeState, LongWritable> input = getBiggerGraph(conf);
    InMemoryVertexOutputFormat.initializeOutputGraph(conf);
    InternalVertexRunner.run(conf, input);
    TestGraph<Text, LouvainNodeState, Text> output = InMemoryVertexOutputFormat.getOutputGraph();
    assertTrue(output.getVertices().size() == 16);
    assertTrue(output.getVertex(new Text("1")).getValue().getCommunity().equals("1"));
    assertTrue(output.getVertex(new Text("2")).getValue().getCommunity().equals("2"));
    assertTrue(output.getVertex(new Text("3")).getValue().getCommunity().equals("3"));
    assertTrue(output.getVertex(new Text("4")).getValue().getCommunity().equals("4"));
    assertTrue(output.getVertex(new Text("5")).getValue().getCommunity().equals("5"));
    assertTrue(output.getVertex(new Text("6")).getValue().getCommunity().equals("6"));
    assertTrue(output.getVertex(new Text("7")).getValue().getCommunity().equals("7"));
    assertTrue(output.getVertex(new Text("8")).getValue().getCommunity().equals("8"));
    assertTrue(output.getVertex(new Text("9")).getValue().getCommunity().equals("9"));
    assertTrue(output.getVertex(new Text("10")).getValue().getCommunity().equals("10"));
    assertTrue(output.getVertex(new Text("11")).getValue().getCommunity().equals("11"));
    assertTrue(output.getVertex(new Text("12")).getValue().getCommunity().equals("12"));
    assertTrue(output.getVertex(new Text("13")).getValue().getCommunity().equals("13"));
    assertTrue(output.getVertex(new Text("14")).getValue().getCommunity().equals("14"));
    assertTrue(output.getVertex(new Text("15")).getValue().getCommunity().equals("15"));
    assertTrue(output.getVertex(new Text("16")).getValue().getCommunity().equals("16"));
}
 
开发者ID:Sotera,项目名称:distributed-graph-analytics,代码行数:26,代码来源:LouvainTests.java

示例8: getBiggerGraph

import org.apache.giraph.conf.GiraphConfiguration; //导入依赖的package包/类
private TestGraph<Text, LouvainNodeState, LongWritable> getBiggerGraph(GiraphConfiguration conf) {
    TestGraph<Text, LouvainNodeState, LongWritable> testGraph = new TestGraph<Text, LouvainNodeState, LongWritable>(conf);
    testGraph.addEdge(new Text("1"), new Text("2"), new LongWritable(1L));
    testGraph.addEdge(new Text("1"), new Text("3"), new LongWritable(1L));
    testGraph.addEdge(new Text("1"), new Text("4"), new LongWritable(1L));
    testGraph.addEdge(new Text("1"), new Text("5"), new LongWritable(1L));
    testGraph.addEdge(new Text("1"), new Text("6"), new LongWritable(1L));
    testGraph.addEdge(new Text("1"), new Text("7"), new LongWritable(1L));
    testGraph.addEdge(new Text("1"), new Text("8"), new LongWritable(1L));
    testGraph.addEdge(new Text("1"), new Text("9"), new LongWritable(1L));
    testGraph.addEdge(new Text("9"), new Text("10"), new LongWritable(1L));
    testGraph.addEdge(new Text("9"), new Text("11"), new LongWritable(1L));
    testGraph.addEdge(new Text("9"), new Text("12"), new LongWritable(1L));
    testGraph.addEdge(new Text("9"), new Text("13"), new LongWritable(1L));
    testGraph.addEdge(new Text("9"), new Text("14"), new LongWritable(1L));
    testGraph.addEdge(new Text("9"), new Text("15"), new LongWritable(1L));
    testGraph.addEdge(new Text("9"), new Text("16"), new LongWritable(1L));
    return testGraph;
}
 
开发者ID:Sotera,项目名称:distributed-graph-analytics,代码行数:20,代码来源:LouvainTests.java

示例9: testComputeOutput

import org.apache.giraph.conf.GiraphConfiguration; //导入依赖的package包/类
@Test
public void testComputeOutput() throws Exception {
    GiraphConfiguration conf = getConf();
    TestGraph<Text, VertexData, Text> input = getFirstTestGraph(conf);
    InMemoryVertexOutputFormat.initializeOutputGraph(conf);
    InternalVertexRunner.run(conf, input);
    TestGraph<Text, VertexData, Text> output = InMemoryVertexOutputFormat.getOutputGraph();
    assertEquals(8, output.getVertices().size());
    assertTrue(output.getVertex(new Text("2")).getValue().getApproxBetweenness() > 0.0);
    assertTrue(output.getVertex(new Text("1")).getValue().getApproxBetweenness() > 0.0);
    assertEquals(output.getVertex(new Text("3")).getValue().getApproxBetweenness(), 0.0, 0.0);
    assertEquals(output.getVertex(new Text("4")).getValue().getApproxBetweenness(), 0.0, 0.0);
    assertEquals(output.getVertex(new Text("5")).getValue().getApproxBetweenness(), 0.0, 0.0);
    assertEquals(output.getVertex(new Text("6")).getValue().getApproxBetweenness(), 0.0, 0.0);
    assertEquals(output.getVertex(new Text("7")).getValue().getApproxBetweenness(), 0.0, 0.0);
    assertEquals(output.getVertex(new Text("8")).getValue().getApproxBetweenness(), 0.0, 0.0);
}
 
开发者ID:Sotera,项目名称:distributed-graph-analytics,代码行数:18,代码来源:HBSEComputeTest.java

示例10: testGraphWithShortestPathOne

import org.apache.giraph.conf.GiraphConfiguration; //导入依赖的package包/类
@Test
public void testGraphWithShortestPathOne() throws Exception {
    GiraphConfiguration conf = getConf();
    TestGraph<Text, VertexData, Text> input = getShortestPathOneTestGraph(conf);
    InMemoryVertexOutputFormat.initializeOutputGraph(conf);
    InternalVertexRunner.run(conf, input);
    TestGraph<Text, VertexData, Text> output = InMemoryVertexOutputFormat.getOutputGraph();
    assertEquals(8, output.getVertices().size());
    assertNotSame(output.getVertex(new Text("1")).getValue().getApproxBetweenness(), 0.0);
    assertEquals(output.getVertex(new Text("2")).getValue().getApproxBetweenness(), 0.0, 0.0);
    assertEquals(output.getVertex(new Text("3")).getValue().getApproxBetweenness(), 0.0, 0.0);
    assertEquals(output.getVertex(new Text("4")).getValue().getApproxBetweenness(), 0.0, 0.0);
    assertEquals(output.getVertex(new Text("5")).getValue().getApproxBetweenness(), 0.0, 0.0);
    assertEquals(output.getVertex(new Text("6")).getValue().getApproxBetweenness(), 0.0, 0.0);
    assertEquals(output.getVertex(new Text("7")).getValue().getApproxBetweenness(), 0.0, 0.0);
    assertEquals(output.getVertex(new Text("8")).getValue().getApproxBetweenness(), 0.0, 0.0);

}
 
开发者ID:Sotera,项目名称:distributed-graph-analytics,代码行数:19,代码来源:HBSEComputeTest.java

示例11: getTwoCriticalPointGraph

import org.apache.giraph.conf.GiraphConfiguration; //导入依赖的package包/类
private TestGraph<Text, VertexData, Text> getTwoCriticalPointGraph(GiraphConfiguration conf) {
    TestGraph<Text, VertexData, Text> testGraph = new TestGraph<Text, VertexData, Text>(conf);
    testGraph.addEdge(new Text("1"), new Text("2"), new Text("1"));
    testGraph.addEdge(new Text("1"), new Text("3"), new Text("1"));
    testGraph.addEdge(new Text("1"), new Text("4"), new Text("1"));
    testGraph.addEdge(new Text("1"), new Text("5"), new Text("1"));
    testGraph.addEdge(new Text("1"), new Text("6"), new Text("1"));
    testGraph.addEdge(new Text("1"), new Text("7"), new Text("1"));
    testGraph.addEdge(new Text("1"), new Text("8"), new Text("1"));
    testGraph.addEdge(new Text("9"), new Text("10"), new Text("1"));
    testGraph.addEdge(new Text("9"), new Text("11"), new Text("1"));
    testGraph.addEdge(new Text("9"), new Text("12"), new Text("1"));
    testGraph.addEdge(new Text("9"), new Text("13"), new Text("1"));
    testGraph.addEdge(new Text("9"), new Text("14"), new Text("1"));
    testGraph.addEdge(new Text("9"), new Text("15"), new Text("1"));
    testGraph.addEdge(new Text("9"), new Text("16"), new Text("1"));
    testGraph.addEdge(new Text("1"), new Text("9"), new Text("1"));
    testGraph.addEdge(new Text("9"), new Text("1"), new Text("1"));
    return testGraph;
}
 
开发者ID:Sotera,项目名称:distributed-graph-analytics,代码行数:21,代码来源:HBSEComputeTest.java

示例12: getShortestPathOneTestGraph

import org.apache.giraph.conf.GiraphConfiguration; //导入依赖的package包/类
private TestGraph<Text, VertexData, Text> getShortestPathOneTestGraph(GiraphConfiguration conf) {
    TestGraph<Text, VertexData, Text> testGraph = new TestGraph<Text, VertexData, Text>(conf);
    testGraph.addEdge(new Text("1"), new Text("2"), new Text("1"));
    testGraph.addEdge(new Text("1"), new Text("3"), new Text("1"));
    testGraph.addEdge(new Text("1"), new Text("4"), new Text("1"));
    testGraph.addEdge(new Text("1"), new Text("5"), new Text("1"));
    testGraph.addEdge(new Text("1"), new Text("6"), new Text("1"));
    testGraph.addEdge(new Text("1"), new Text("7"), new Text("1"));
    testGraph.addEdge(new Text("1"), new Text("8"), new Text("1"));
    testGraph.addEdge(new Text("2"), new Text("1"), new Text("1"));
    testGraph.addEdge(new Text("3"), new Text("1"), new Text("1"));
    testGraph.addEdge(new Text("4"), new Text("1"), new Text("1"));
    testGraph.addEdge(new Text("5"), new Text("1"), new Text("1"));
    testGraph.addEdge(new Text("6"), new Text("1"), new Text("1"));
    testGraph.addEdge(new Text("7"), new Text("1"), new Text("1"));
    testGraph.addEdge(new Text("8"), new Text("1"), new Text("1"));
    return testGraph;
}
 
开发者ID:Sotera,项目名称:distributed-graph-analytics,代码行数:19,代码来源:HBSEComputeTest.java

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

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

示例15: testBspFail

import org.apache.giraph.conf.GiraphConfiguration; //导入依赖的package包/类
/**
 * Run a sample BSP job in JobTracker, kill a task, and make sure
 * the job fails (not enough attempts to restart)
 *
 * @throws IOException
 * @throws ClassNotFoundException
 * @throws InterruptedException
 */
@Test
public void testBspFail()
    throws IOException, InterruptedException, ClassNotFoundException {
  // Allow this test only to be run on a real Hadoop setup
  if (!runningInDistributedMode()) {
    System.out.println("testBspFail: not executed for local setup.");
    return;
  }

  GiraphConfiguration conf = new GiraphConfiguration();
  conf.setVertexClass(SimpleFailVertex.class);
  conf.setVertexInputFormatClass(SimplePageRankVertexInputFormat.class);
  GiraphJob job = prepareJob(getCallingMethodName(), conf,
      getTempPath(getCallingMethodName()));
  job.getConfiguration().setInt("mapred.map.max.attempts", 1);
  assertTrue(!job.run(true));
}
 
开发者ID:zfighter,项目名称:giraph-research,代码行数:26,代码来源:TestBspBasic.java


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