Search in sources :

Example 1 with ChecksumHashCode

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

the class VertexInDegreeTest method testWithRMatGraph.

@Test
public void testWithRMatGraph() throws Exception {
    DataSet<Vertex<LongValue, LongValue>> inDegree = directedRMatGraph.run(new VertexInDegree<LongValue, NullValue, NullValue>().setIncludeZeroDegreeVertices(true));
    Checksum checksum = new ChecksumHashCode<Vertex<LongValue, LongValue>>().run(inDegree).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 2 with ChecksumHashCode

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

the class EdgeSourceDegreeTest method testWithRMatGraph.

@Test
public void testWithRMatGraph() throws Exception {
    DataSet<Edge<LongValue, Tuple2<NullValue, LongValue>>> sourceDegreeOnSourceId = undirectedRMatGraph.run(new EdgeSourceDegree<LongValue, NullValue, NullValue>());
    Checksum checksumOnSourceId = new ChecksumHashCode<Edge<LongValue, Tuple2<NullValue, LongValue>>>().run(sourceDegreeOnSourceId).execute();
    assertEquals(20884, checksumOnSourceId.getCount());
    assertEquals(0x000000019d8f0070L, checksumOnSourceId.getChecksum());
    DataSet<Edge<LongValue, Tuple2<NullValue, LongValue>>> sourceDegreeOnTargetId = undirectedRMatGraph.run(new EdgeSourceDegree<LongValue, NullValue, NullValue>().setReduceOnTargetId(true));
    Checksum checksumOnTargetId = new ChecksumHashCode<Edge<LongValue, Tuple2<NullValue, LongValue>>>().run(sourceDegreeOnTargetId).execute();
    assertEquals(checksumOnTargetId, checksumOnTargetId);
}
Also used : NullValue(org.apache.flink.types.NullValue) Checksum(org.apache.flink.graph.asm.dataset.ChecksumHashCode.Checksum) Tuple2(org.apache.flink.api.java.tuple.Tuple2) 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 3 with ChecksumHashCode

use of org.apache.flink.graph.asm.dataset.ChecksumHashCode 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);
}
Also used : NullValue(org.apache.flink.types.NullValue) Checksum(org.apache.flink.graph.asm.dataset.ChecksumHashCode.Checksum) Tuple2(org.apache.flink.api.java.tuple.Tuple2) 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 4 with ChecksumHashCode

use of org.apache.flink.graph.asm.dataset.ChecksumHashCode 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);
}
Also used : Vertex(org.apache.flink.graph.Vertex) 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) Test(org.junit.Test)

Example 5 with ChecksumHashCode

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

the class JaccardIndexTest method testRMatGraph.

@Test
public void testRMatGraph() throws Exception {
    long vertexCount = 1 << 8;
    long edgeCount = 8 * vertexCount;
    RandomGenerableFactory<JDKRandomGenerator> rnd = new JDKRandomGeneratorFactory();
    Graph<LongValue, NullValue, NullValue> graph = new RMatGraph<>(env, rnd, vertexCount, edgeCount).generate().run(new Simplify<LongValue, NullValue, NullValue>(false));
    DataSet<Result<LongValue>> ji = graph.run(new JaccardIndex<LongValue, NullValue, NullValue>().setGroupSize(4));
    Checksum checksum = new ChecksumHashCode<Result<LongValue>>().run(ji).execute();
    assertEquals(13954, checksum.getCount());
    assertEquals(0x00001b1a1f7a9d0bL, checksum.getChecksum());
}
Also used : JDKRandomGeneratorFactory(org.apache.flink.graph.generator.random.JDKRandomGeneratorFactory) ChecksumHashCode(org.apache.flink.graph.asm.dataset.ChecksumHashCode) Result(org.apache.flink.graph.library.similarity.JaccardIndex.Result) RMatGraph(org.apache.flink.graph.generator.RMatGraph) NullValue(org.apache.flink.types.NullValue) Checksum(org.apache.flink.graph.asm.dataset.ChecksumHashCode.Checksum) LongValue(org.apache.flink.types.LongValue) JDKRandomGenerator(org.apache.commons.math3.random.JDKRandomGenerator) 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