use of org.apache.flink.types.NullValue in project flink by apache.
the class EdgeTargetDegreeTest method testWithRMatGraph.
@Test
public void testWithRMatGraph() throws Exception {
DataSet<Edge<LongValue, Tuple2<NullValue, LongValue>>> targetDegreeOnTargetId = undirectedRMatGraph.run(new EdgeSourceDegree<LongValue, NullValue, NullValue>());
Checksum checksumOnTargetId = new ChecksumHashCode<Edge<LongValue, Tuple2<NullValue, LongValue>>>().run(targetDegreeOnTargetId).execute();
assertEquals(20884, checksumOnTargetId.getCount());
assertEquals(0x000000019d8f0070L, checksumOnTargetId.getChecksum());
DataSet<Edge<LongValue, Tuple2<NullValue, LongValue>>> targetDegreeOnSourceId = undirectedRMatGraph.run(new EdgeTargetDegree<LongValue, NullValue, NullValue>().setReduceOnSourceId(true));
Checksum checksumOnSourceId = new ChecksumHashCode<Edge<LongValue, Tuple2<NullValue, LongValue>>>().run(targetDegreeOnSourceId).execute();
assertEquals(checksumOnTargetId, checksumOnSourceId);
}
use of org.apache.flink.types.NullValue in project flink by apache.
the class VertexDegreeTest method testWithRMatGraph.
@Test
public void testWithRMatGraph() throws Exception {
DataSet<Vertex<LongValue, LongValue>> degreeOnSourceId = undirectedRMatGraph.run(new VertexDegree<LongValue, NullValue, NullValue>());
Checksum checksumOnSourceId = new ChecksumHashCode<Vertex<LongValue, LongValue>>().run(degreeOnSourceId).execute();
assertEquals(902, checksumOnSourceId.getCount());
assertEquals(0x0000000000e1fb30L, checksumOnSourceId.getChecksum());
DataSet<Vertex<LongValue, LongValue>> degreeOnTargetId = undirectedRMatGraph.run(new VertexDegree<LongValue, NullValue, NullValue>().setReduceOnTargetId(true));
Checksum checksumOnTargetId = new ChecksumHashCode<Vertex<LongValue, LongValue>>().run(degreeOnTargetId).execute();
assertEquals(checksumOnSourceId, checksumOnTargetId);
}
use of org.apache.flink.types.NullValue in project flink by apache.
the class MaximumDegreeTest method testWithRMatGraph.
@Test
public void testWithRMatGraph() throws Exception {
Checksum checksum = undirectedRMatGraph.run(new MaximumDegree<LongValue, NullValue, NullValue>(16)).run(new ChecksumHashCode<LongValue, NullValue, NullValue>()).execute();
assertEquals(805, checksum.getCount());
assertEquals(0x0000000008028b43L, checksum.getChecksum());
}
use of org.apache.flink.types.NullValue in project flink by apache.
the class DegreesITCase method testGetDegreesWithDisconnectedData.
@Test
public void testGetDegreesWithDisconnectedData() throws Exception {
/*
* Test getDegrees() with disconnected data
*/
final ExecutionEnvironment env = ExecutionEnvironment.getExecutionEnvironment();
Graph<Long, NullValue, Long> graph = Graph.fromDataSet(TestGraphUtils.getDisconnectedLongLongEdgeData(env), env);
DataSet<Tuple2<Long, LongValue>> data = graph.outDegrees();
List<Tuple2<Long, LongValue>> result = data.collect();
expectedResult = "1,2\n" + "2,1\n" + "3,0\n" + "4,1\n" + "5,0\n";
compareResultAsTuples(result, expectedResult);
}
use of org.apache.flink.types.NullValue in project flink by apache.
the class FromCollectionITCase method testFromCollectionEdgesNoInitialValue.
@Test
public void testFromCollectionEdgesNoInitialValue() throws Exception {
/*
* Test fromCollection(edges) with no initial value for the vertices
*/
final ExecutionEnvironment env = ExecutionEnvironment.getExecutionEnvironment();
Graph<Long, NullValue, Long> graph = Graph.fromCollection(TestGraphUtils.getLongLongEdges(), env);
DataSet<Vertex<Long, NullValue>> data = graph.getVertices();
List<Vertex<Long, NullValue>> result = data.collect();
expectedResult = "1,(null)\n" + "2,(null)\n" + "3,(null)\n" + "4,(null)\n" + "5,(null)\n";
compareResultAsTuples(result, expectedResult);
}
Aggregations