本文整理汇总了Java中org.apache.giraph.io.formats.AdjacencyListTextVertexInputFormat类的典型用法代码示例。如果您正苦于以下问题:Java AdjacencyListTextVertexInputFormat类的具体用法?Java AdjacencyListTextVertexInputFormat怎么用?Java AdjacencyListTextVertexInputFormat使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
AdjacencyListTextVertexInputFormat类属于org.apache.giraph.io.formats包,在下文中一共展示了AdjacencyListTextVertexInputFormat类的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: testDifferentSeparators
import org.apache.giraph.io.formats.AdjacencyListTextVertexInputFormat; //导入依赖的package包/类
@Test
public void testDifferentSeparators() throws Exception {
String input = "12345:42.42:9999999:99.9";
when(rr.getCurrentValue()).thenReturn(new Text(input));
conf.set(AdjacencyListTextVertexInputFormat.LINE_TOKENIZE_VALUE, ":");
TextVertexReader vr = createVertexReader(rr);
vr.setConf(conf);
vr.initialize(null, tac);
assertTrue("Should have been able to read vertex", vr.nextVertex());
Vertex<LongWritable, DoubleWritable, DoubleWritable>
vertex = vr.getCurrentVertex();
assertValidVertex(conf, vertex,
new LongWritable(12345), new DoubleWritable(42.42),
EdgeFactory.create(new LongWritable(9999999), new DoubleWritable(99.9)));
assertEquals(vertex.getNumEdges(), 1);
}
开发者ID:renato2099,项目名称:giraph-gora,代码行数:18,代码来源:TestLongDoubleDoubleAdjacencyListVertexInputFormat.java
示例2: testLineSanitizer
import org.apache.giraph.io.formats.AdjacencyListTextVertexInputFormat; //导入依赖的package包/类
@Test
public void testLineSanitizer() throws Exception {
String input = "Bye\t0.01\tCiao\t1.001\tTchau\t2.0001\tAdios\t3.00001";
AdjacencyListTextVertexInputFormat.LineSanitizer toUpper =
new AdjacencyListTextVertexInputFormat.LineSanitizer() {
@Override
public String sanitize(String s) {
return s.toUpperCase();
}
};
when(rr.getCurrentValue()).thenReturn(new Text(input));
TextVertexReader vr = createVertexReader(rr, toUpper);
vr.setConf(conf);
vr.initialize(null, tac);
assertTrue("Should have been able to read vertex", vr.nextVertex());
Vertex<Text, DoubleWritable, DoubleWritable> vertex = vr.getCurrentVertex();
assertValidVertex(conf, vertex,
new Text("BYE"), new DoubleWritable(0.01d),
EdgeFactory.create(new Text("CIAO"), new DoubleWritable(1.001d)),
EdgeFactory.create(new Text("TCHAU"), new DoubleWritable(2.0001d)),
EdgeFactory.create(new Text("ADIOS"), new DoubleWritable(3.00001d)));
assertEquals(vertex.getNumEdges(), 3);
}
开发者ID:renato2099,项目名称:giraph-gora,代码行数:27,代码来源:TestTextDoubleDoubleAdjacencyListVertexInputFormat.java
示例3: testDifferentSeparators
import org.apache.giraph.io.formats.AdjacencyListTextVertexInputFormat; //导入依赖的package包/类
@Test
public void testDifferentSeparators() throws Exception {
String input = "alpha:42:beta:99";
when(rr.getCurrentValue()).thenReturn(new Text(input));
conf.set(AdjacencyListTextVertexInputFormat.LINE_TOKENIZE_VALUE, ":");
TextVertexReader vr = createVertexReader(rr);
vr.setConf(conf);
vr.initialize(null, tac);
assertTrue("Should have been able to read vertex", vr.nextVertex());
Vertex<Text, DoubleWritable, DoubleWritable> vertex = vr.getCurrentVertex();
assertValidVertex(conf, vertex,
new Text("alpha"), new DoubleWritable(42d),
EdgeFactory.create(new Text("beta"), new DoubleWritable(99d)));
assertEquals(vertex.getNumEdges(), 1);
}
开发者ID:renato2099,项目名称:giraph-gora,代码行数:17,代码来源:TestTextDoubleDoubleAdjacencyListVertexInputFormat.java
示例4: testDifferentSeparators
import org.apache.giraph.io.formats.AdjacencyListTextVertexInputFormat; //导入依赖的package包/类
@Test
public void testDifferentSeparators() throws Exception {
String input = "12345:42.42:9999999:99.9";
when(rr.getCurrentValue()).thenReturn(new Text(input));
conf.set(AdjacencyListTextVertexInputFormat.LINE_TOKENIZE_VALUE, ":");
TextVertexReader vr = createVertexReader(rr);
vr.setConf(conf);
vr.initialize(null, tac);
assertTrue("Should have been able to read vertex", vr.nextVertex());
Vertex<LongWritable, DoubleWritable, DoubleWritable, ?>
vertex = vr.getCurrentVertex();
setGraphState(vertex, graphState);
assertValidVertex(conf, graphState, vertex,
new LongWritable(12345), new DoubleWritable(42.42),
EdgeFactory.create(new LongWritable(9999999), new DoubleWritable(99.9)));
assertEquals(vertex.getNumEdges(), 1);
}
开发者ID:zfighter,项目名称:giraph-research,代码行数:19,代码来源:TestLongDoubleDoubleAdjacencyListVertexInputFormat.java
示例5: testDifferentSeparators
import org.apache.giraph.io.formats.AdjacencyListTextVertexInputFormat; //导入依赖的package包/类
@Test
public void testDifferentSeparators() throws Exception {
String input = "alpha:42:beta:99";
when(rr.getCurrentValue()).thenReturn(new Text(input));
conf.set(AdjacencyListTextVertexInputFormat.LINE_TOKENIZE_VALUE, ":");
TextVertexReader vr = createVertexReader(rr);
vr.setConf(conf);
vr.initialize(null, tac);
assertTrue("Should have been able to read vertex", vr.nextVertex());
Vertex<Text, DoubleWritable, DoubleWritable, ?> vertex = vr.getCurrentVertex();
setGraphState(vertex, graphState);
assertValidVertex(conf, graphState, vertex,
new Text("alpha"), new DoubleWritable(42d),
EdgeFactory.create(new Text("beta"), new DoubleWritable(99d)));
assertEquals(vertex.getNumEdges(), 1);
}
开发者ID:zfighter,项目名称:giraph-research,代码行数:18,代码来源:TestTextDoubleDoubleAdjacencyListVertexInputFormat.java
示例6: testLineSanitizer
import org.apache.giraph.io.formats.AdjacencyListTextVertexInputFormat; //导入依赖的package包/类
@Test
public void testLineSanitizer() throws Exception {
String input = "Bye\t0.01\tCiao\t1.001\tTchau\t2.0001\tAdios\t3.00001";
AdjacencyListTextVertexInputFormat.LineSanitizer toUpper =
new AdjacencyListTextVertexInputFormat.LineSanitizer() {
@Override
public String sanitize(String s) {
return s.toUpperCase();
}
};
when(rr.getCurrentValue()).thenReturn(new Text(input));
TextVertexReader vr = createVertexReader(rr, toUpper);
vr.setConf(conf);
vr.initialize(null, tac);
assertTrue("Should have been able to read vertex", vr.nextVertex());
Vertex<Text, DoubleWritable, DoubleWritable, ?> vertex = vr.getCurrentVertex();
setGraphState(vertex, graphState);
assertValidVertex(conf, graphState, vertex,
new Text("BYE"), new DoubleWritable(0.01d),
EdgeFactory.create(new Text("CIAO"), new DoubleWritable(1.001d)),
EdgeFactory.create(new Text("TCHAU"), new DoubleWritable(2.0001d)),
EdgeFactory.create(new Text("ADIOS"), new DoubleWritable(3.00001d)));
assertEquals(vertex.getNumEdges(), 3);
}
开发者ID:zfighter,项目名称:giraph-research,代码行数:28,代码来源:TestTextDoubleDoubleAdjacencyListVertexInputFormat.java