Search in sources :

Example 11 with ChecksumHashCode

use of org.apache.flink.graph.asm.dataset.ChecksumHashCode in project flink by apache.

the class VertexOutDegreeTest method testWithRMatGraph.

@Test
public void testWithRMatGraph() throws Exception {
    DataSet<Vertex<LongValue, LongValue>> outDegree = directedRMatGraph.run(new VertexOutDegree<LongValue, NullValue, NullValue>().setIncludeZeroDegreeVertices(true));
    Checksum checksum = new ChecksumHashCode<Vertex<LongValue, LongValue>>().run(outDegree).execute();
    assertEquals(902, checksum.getCount());
    assertEquals(0x0000000000e1d885L, checksum.getChecksum());
}
Also used : Vertex(org.apache.flink.graph.Vertex) Checksum(org.apache.flink.graph.asm.dataset.ChecksumHashCode.Checksum) LongValue(org.apache.flink.types.LongValue) ChecksumHashCode(org.apache.flink.graph.asm.dataset.ChecksumHashCode) Test(org.junit.Test)

Example 12 with ChecksumHashCode

use of org.apache.flink.graph.asm.dataset.ChecksumHashCode in project flink by apache.

the class EdgeDegreePairTest method testWithRMatGraph.

@Test
public void testWithRMatGraph() throws Exception {
    DataSet<Edge<LongValue, Tuple3<NullValue, LongValue, LongValue>>> degreePairOnSourceId = undirectedRMatGraph.run(new EdgeDegreePair<LongValue, NullValue, NullValue>());
    Checksum checksumOnSourceId = new ChecksumHashCode<Edge<LongValue, Tuple3<NullValue, LongValue, LongValue>>>().run(degreePairOnSourceId).execute();
    assertEquals(20884, checksumOnSourceId.getCount());
    assertEquals(0x00000001e051efe4L, checksumOnSourceId.getChecksum());
    DataSet<Edge<LongValue, Tuple3<NullValue, LongValue, LongValue>>> degreePairOnTargetId = undirectedRMatGraph.run(new EdgeDegreePair<LongValue, NullValue, NullValue>().setReduceOnTargetId(true));
    Checksum checksumOnTargetId = new ChecksumHashCode<Edge<LongValue, Tuple3<NullValue, LongValue, LongValue>>>().run(degreePairOnTargetId).execute();
    assertEquals(checksumOnSourceId, checksumOnTargetId);
}
Also used : NullValue(org.apache.flink.types.NullValue) Checksum(org.apache.flink.graph.asm.dataset.ChecksumHashCode.Checksum) Tuple3(org.apache.flink.api.java.tuple.Tuple3) LongValue(org.apache.flink.types.LongValue) ChecksumHashCode(org.apache.flink.graph.asm.dataset.ChecksumHashCode) Edge(org.apache.flink.graph.Edge) Test(org.junit.Test)

Example 13 with ChecksumHashCode

use of org.apache.flink.graph.asm.dataset.ChecksumHashCode in project flink by apache.

the class LocalClusteringCoefficientTest method testRMatGraph.

@Test
public void testRMatGraph() throws Exception {
    DataSet<Result<LongValue>> cc = undirectedRMatGraph.run(new LocalClusteringCoefficient<LongValue, NullValue, NullValue>());
    Checksum checksum = new ChecksumHashCode<Result<LongValue>>().run(cc).execute();
    assertEquals(902, checksum.getCount());
    assertEquals(0x000001cab2d3677bL, checksum.getChecksum());
}
Also used : NullValue(org.apache.flink.types.NullValue) Checksum(org.apache.flink.graph.asm.dataset.ChecksumHashCode.Checksum) LongValue(org.apache.flink.types.LongValue) ChecksumHashCode(org.apache.flink.graph.asm.dataset.ChecksumHashCode) Result(org.apache.flink.graph.library.clustering.undirected.LocalClusteringCoefficient.Result) Test(org.junit.Test)

Example 14 with ChecksumHashCode

use of org.apache.flink.graph.asm.dataset.ChecksumHashCode in project flink by apache.

the class TriangleListingTest method testCompleteGraph.

@Test
public void testCompleteGraph() throws Exception {
    long expectedDegree = completeGraphVertexCount - 1;
    long expectedCount = completeGraphVertexCount * CombinatoricsUtils.binomialCoefficient((int) expectedDegree, 2) / 3;
    DataSet<Result<LongValue>> tl = completeGraph.run(new TriangleListing<LongValue, NullValue, NullValue>());
    Checksum checksum = new ChecksumHashCode<Result<LongValue>>().run(tl).execute();
    assertEquals(expectedCount, checksum.getCount());
}
Also used : NullValue(org.apache.flink.types.NullValue) Checksum(org.apache.flink.graph.asm.dataset.ChecksumHashCode.Checksum) LongValue(org.apache.flink.types.LongValue) ChecksumHashCode(org.apache.flink.graph.asm.dataset.ChecksumHashCode) Result(org.apache.flink.graph.library.clustering.undirected.TriangleListing.Result) Test(org.junit.Test)

Example 15 with ChecksumHashCode

use of org.apache.flink.graph.asm.dataset.ChecksumHashCode in project flink by apache.

the class TriangleListingTest method testRMatGraph.

@Test
public void testRMatGraph() throws Exception {
    DataSet<Result<LongValue>> tl = undirectedRMatGraph.run(new TriangleListing<LongValue, NullValue, NullValue>().setSortTriangleVertices(true));
    Checksum checksum = new ChecksumHashCode<Result<LongValue>>().run(tl).execute();
    assertEquals(75049, checksum.getCount());
    assertEquals(0x00000001a5b500afL, checksum.getChecksum());
}
Also used : Checksum(org.apache.flink.graph.asm.dataset.ChecksumHashCode.Checksum) LongValue(org.apache.flink.types.LongValue) ChecksumHashCode(org.apache.flink.graph.asm.dataset.ChecksumHashCode) Result(org.apache.flink.graph.library.clustering.undirected.TriangleListing.Result) Test(org.junit.Test)

Aggregations

ChecksumHashCode (org.apache.flink.graph.asm.dataset.ChecksumHashCode)15 Checksum (org.apache.flink.graph.asm.dataset.ChecksumHashCode.Checksum)15 LongValue (org.apache.flink.types.LongValue)15 Test (org.junit.Test)15 NullValue (org.apache.flink.types.NullValue)11 Edge (org.apache.flink.graph.Edge)6 Tuple2 (org.apache.flink.api.java.tuple.Tuple2)4 Vertex (org.apache.flink.graph.Vertex)4 Degrees (org.apache.flink.graph.asm.degree.annotate.directed.VertexDegrees.Degrees)4 Tuple3 (org.apache.flink.api.java.tuple.Tuple3)2 Result (org.apache.flink.graph.library.clustering.undirected.TriangleListing.Result)2 JDKRandomGenerator (org.apache.commons.math3.random.JDKRandomGenerator)1 RMatGraph (org.apache.flink.graph.generator.RMatGraph)1 JDKRandomGeneratorFactory (org.apache.flink.graph.generator.random.JDKRandomGeneratorFactory)1 Result (org.apache.flink.graph.library.clustering.directed.TriangleListing.Result)1 Result (org.apache.flink.graph.library.clustering.undirected.LocalClusteringCoefficient.Result)1 Result (org.apache.flink.graph.library.similarity.JaccardIndex.Result)1