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


Java InternalVertexRunner类代码示例

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


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

示例1: testEqualPageRankForSevenNodes

import org.apache.giraph.utils.InternalVertexRunner; //导入依赖的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

示例2: testHighPageRankForOneNode

import org.apache.giraph.utils.InternalVertexRunner; //导入依赖的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

示例3: testBiggerGraph

import org.apache.giraph.utils.InternalVertexRunner; //导入依赖的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

示例4: testComputationUnconnectedGraph

import org.apache.giraph.utils.InternalVertexRunner; //导入依赖的package包/类
@Test
public void testComputationUnconnectedGraph() throws Exception {
    TestGraph<Text, Text, Text> testGraph = new TestGraph(giraphConf);
    ImmutableClassesGiraphConfiguration conf = new ImmutableClassesGiraphConfiguration(giraphConf);
    testGraph.addEdge(new Text("1"), new Text("2"), new Text("1"));
    testGraph.addEdge(new Text("4"), new Text("3"), new Text("1"));
    testGraph.addEdge(new Text("28"), new Text("16"), new Text("1"));

    InMemoryVertexOutputFormat.initializeOutputGraph(conf);
    InternalVertexRunner.run(conf, testGraph);
    TestGraph<Text, Text, Text> outputGraph = InMemoryVertexOutputFormat.getOutputGraph();
    assertEquals(3, outputGraph.getVertices().size());
    assertNull(outputGraph.getVertex(new Text("1")));
    assertNotNull(outputGraph.getVertex(new Text("2")));
    assertEquals(0, outputGraph.getVertex(new Text("2")).getNumEdges());
    assertNull(outputGraph.getVertex(new Text("4")));
    assertNotNull(outputGraph.getVertex(new Text("3")));
    assertEquals(0, outputGraph.getVertex(new Text("3")).getNumEdges());
    assertNull(outputGraph.getVertex(new Text("28")));
    assertNotNull(outputGraph.getVertex(new Text("16")));
    assertEquals(0, outputGraph.getVertex(new Text("16")).getNumEdges());
}
 
开发者ID:Sotera,项目名称:distributed-graph-analytics,代码行数:23,代码来源:LeafCompressionComputationTest.java

示例5: testActualTextNodes

import org.apache.giraph.utils.InternalVertexRunner; //导入依赖的package包/类
@Test
public void testActualTextNodes() throws Exception {
    TestGraph<Text, Text, Text> testGraph = new TestGraph(giraphConf);
    ImmutableClassesGiraphConfiguration conf = new ImmutableClassesGiraphConfiguration(giraphConf);
    testGraph.addEdge(new Text("Jack"), new Text("Jill"), new Text("1"));
    testGraph.addEdge(new Text("Jill"), new Text("Jack"), new Text("1"));
    testGraph.addEdge(new Text("Jane"), new Text("Jill"), new Text("1"));
    testGraph.addEdge(new Text("Jill"), new Text("Jane"), new Text("1"));
    testGraph.addEdge(new Text("Jack"), new Text("Jane"), new Text("1"));
    testGraph.addEdge(new Text("Jane"), new Text("Jack"), new Text("1"));
    testGraph.addEdge(new Text("Jane"), new Text("Gregory"), new Text("1"));
    testGraph.addEdge(new Text("Gregory"), new Text("Straxx"), new Text("1"));

    InMemoryVertexOutputFormat.initializeOutputGraph(conf);
    InternalVertexRunner.run(conf, testGraph);
    TestGraph<Text, Text, Text> outputGraph = InMemoryVertexOutputFormat.getOutputGraph();
    assertEquals(4, outputGraph.getVertices().size());
    checkConnectionsFromVertex(outputGraph, "Jack", "Jane", "Jill");
    checkConnectionsFromVertex(outputGraph, "Jane", "Jack", "Jill");
    checkConnectionsFromVertex(outputGraph, "Jill", "Jack", "Jane");
    assertEquals(0, outputGraph.getVertex(new Text("Straxx")).getNumEdges());
}
 
开发者ID:Sotera,项目名称:distributed-graph-analytics,代码行数:23,代码来源:LeafCompressionComputationTest.java

示例6: testComputeOutput

import org.apache.giraph.utils.InternalVertexRunner; //导入依赖的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

示例7: testGraphWithShortestPathOne

import org.apache.giraph.utils.InternalVertexRunner; //导入依赖的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

示例8: testComputeOutput

import org.apache.giraph.utils.InternalVertexRunner; //导入依赖的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

示例9: testMax

import org.apache.giraph.utils.InternalVertexRunner; //导入依赖的package包/类
@Test
public void testMax() throws Exception {
  String[] graph = {
      "5 1",
      "1 5 2",
      "2 5",
  };

  GiraphConfiguration conf = new GiraphConfiguration();
  conf.setComputationClass(MaxComputation.class);
  conf.setVertexInputFormatClass(IntIntNullTextInputFormat.class);
  conf.setVertexOutputFormatClass(IdWithValueTextOutputFormat.class);
  Iterable<String> results = InternalVertexRunner.run(conf, graph);

  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:renato2099,项目名称:giraph-gora,代码行数:21,代码来源:MaxComputationTest.java

示例10: testThreeNodesAllNodesFreeGraph

import org.apache.giraph.utils.InternalVertexRunner; //导入依赖的package包/类
@Test
public void testThreeNodesAllNodesFreeGraph() throws Exception {
  Iterable<String>    results;
  String[]            graph = {
                                "[1,[]]",
                                "[2,[[1,0]]]",
                                "[3,[[1,0]]]"
                              };
  String[]            expected = {
                                   "1\tisFree=true",
                                   "2\tisFree=false",
                                   "3\tisFree=false" 
                                 };

  results = InternalVertexRunner.run(this.conf, graph);
  checkResults(results, expected);
}
 
开发者ID:renato2099,项目名称:giraph-gora,代码行数:18,代码来源:BrachaTouegDeadlockComputationTest.java

示例11: testThreeNodesAllNodesBlockedGraph

import org.apache.giraph.utils.InternalVertexRunner; //导入依赖的package包/类
@Test
public void testThreeNodesAllNodesBlockedGraph() throws Exception {
  Iterable<String>    results;
  String[]            graph = {
                                "[1,[[2,0]]]",
                                "[2,[[3,0]]]",
                                "[3,[[1,0]]]"
                              };
  String[]            expected = {
                                   "1\tisFree=false",
                                   "2\tisFree=false",
                                   "3\tisFree=false" 
                                 };

  results = InternalVertexRunner.run(this.conf, graph);
  checkResults(results, expected);
}
 
开发者ID:renato2099,项目名称:giraph-gora,代码行数:18,代码来源:BrachaTouegDeadlockComputationTest.java

示例12: testThreeNodesAllNodesFreeMultiEdgesGraph

import org.apache.giraph.utils.InternalVertexRunner; //导入依赖的package包/类
@Test
public void testThreeNodesAllNodesFreeMultiEdgesGraph() throws Exception {
  Iterable<String>    results;
  String[]            graph = {
                                "[1,[[2,0],[3,1]]]",
                                "[2,[]]",
                                "[3,[]]"
                              };
  String[]            expected = {
                                   "1\tisFree=true",
                                   "2\tisFree=true",
                                   "3\tisFree=true" 
                                 };

  results = InternalVertexRunner.run(this.conf, graph);
  checkResults(results, expected);
}
 
开发者ID:renato2099,项目名称:giraph-gora,代码行数:18,代码来源:BrachaTouegDeadlockComputationTest.java

示例13: testThreeNodesAllNodesFreeNOutOfMGraph

import org.apache.giraph.utils.InternalVertexRunner; //导入依赖的package包/类
@Test
public void testThreeNodesAllNodesFreeNOutOfMGraph() throws Exception {
  Iterable<String>    results;
  String[]            graph = {
                                "[1,[[2,0],[3,0]]]",
                                "[2,[]]",
                                "[3,[]]"
                              };
  String[]            expected = {
                                   "1\tisFree=true",
                                   "2\tisFree=true",
                                   "3\tisFree=true" 
                                 };

  results = InternalVertexRunner.run(this.conf, graph);
  checkResults(results, expected);
}
 
开发者ID:renato2099,项目名称:giraph-gora,代码行数:18,代码来源:BrachaTouegDeadlockComputationTest.java

示例14: testThreeNodesInitNodeFreeNOutOfMGraph

import org.apache.giraph.utils.InternalVertexRunner; //导入依赖的package包/类
@Test
public void testThreeNodesInitNodeFreeNOutOfMGraph() throws Exception {
  Iterable<String>    results;
  String[]            graph = {
                                "[1,[[2,0],[3,0]]]",
                                "[2,[]]",
                                "[3,[]]"
                              };
  String[]            expected = {
                                   "1\tisFree=false",
                                   "2\tisFree=true",
                                   "3\tisFree=false" 
                                 };

  BRACHA_TOUEG_DL_INITIATOR_ID.set(this.conf, 2);
  results = InternalVertexRunner.run(this.conf, graph);
  checkResults(results, expected);
  BRACHA_TOUEG_DL_INITIATOR_ID.set(this.conf, 1);
}
 
开发者ID:renato2099,项目名称:giraph-gora,代码行数:20,代码来源:BrachaTouegDeadlockComputationTest.java

示例15: testThreeNodesAllNodesBlockedNOutOfMGraph

import org.apache.giraph.utils.InternalVertexRunner; //导入依赖的package包/类
@Test
public void testThreeNodesAllNodesBlockedNOutOfMGraph() throws Exception {
  Iterable<String>    results;
  String[]            graph = {
                                "[1,[[2,0],[3,0]]]",
                                "[2,[[3,0]]]",
                                "[3,[[2,0]]]"
                              };
  String[]            expected = {
                                   "1\tisFree=false",
                                   "2\tisFree=false",
                                   "3\tisFree=false" 
                                 };

  results = InternalVertexRunner.run(this.conf, graph);
  checkResults(results, expected);
}
 
开发者ID:renato2099,项目名称:giraph-gora,代码行数:18,代码来源:BrachaTouegDeadlockComputationTest.java


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