Search in sources :

Example 16 with LongValue

use of org.apache.flink.types.LongValue 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 17 with LongValue

use of org.apache.flink.types.LongValue 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 18 with LongValue

use of org.apache.flink.types.LongValue 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 19 with LongValue

use of org.apache.flink.types.LongValue 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());
}
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.library.metric.ChecksumHashCode) Test(org.junit.Test)

Example 20 with LongValue

use of org.apache.flink.types.LongValue in project flink by apache.

the class TranslateTest method setup.

@Before
public void setup() {
    ExecutionEnvironment env = ExecutionEnvironment.createCollectionsEnvironment();
    int count = 10;
    List<Vertex<LongValue, LongValue>> vertexList = new LinkedList<>();
    List<Edge<LongValue, LongValue>> edgeList = new LinkedList<>();
    for (long l = 0; l < count; l++) {
        LongValue lv0 = new LongValue(l);
        LongValue lv1 = new LongValue(l + 1);
        LongValue lv2 = new LongValue(l + 2);
        vertexList.add(new Vertex<>(lv0, lv1));
        edgeList.add(new Edge<>(lv0, lv1, lv2));
    }
    graph = Graph.fromCollection(vertexList, edgeList, env);
}
Also used : Vertex(org.apache.flink.graph.Vertex) ExecutionEnvironment(org.apache.flink.api.java.ExecutionEnvironment) LongValue(org.apache.flink.types.LongValue) Edge(org.apache.flink.graph.Edge) LinkedList(java.util.LinkedList) Before(org.junit.Before)

Aggregations

LongValue (org.apache.flink.types.LongValue)50 Test (org.junit.Test)33 NullValue (org.apache.flink.types.NullValue)23 Checksum (org.apache.flink.graph.asm.dataset.ChecksumHashCode.Checksum)17 ChecksumHashCode (org.apache.flink.graph.asm.dataset.ChecksumHashCode)15 Edge (org.apache.flink.graph.Edge)13 StringValue (org.apache.flink.types.StringValue)13 ExecutionEnvironment (org.apache.flink.api.java.ExecutionEnvironment)12 Vertex (org.apache.flink.graph.Vertex)11 IntValue (org.apache.flink.types.IntValue)9 Tuple2 (org.apache.flink.api.java.tuple.Tuple2)7 JDKRandomGeneratorFactory (org.apache.flink.graph.generator.random.JDKRandomGeneratorFactory)7 NumberFormat (java.text.NumberFormat)6 JobExecutionResult (org.apache.flink.api.common.JobExecutionResult)6 Tuple3 (org.apache.flink.api.java.tuple.Tuple3)6 ParameterTool (org.apache.flink.api.java.utils.ParameterTool)6 ProgramParametrizationException (org.apache.flink.client.program.ProgramParametrizationException)6 RMatGraph (org.apache.flink.graph.generator.RMatGraph)6 Graph (org.apache.flink.graph.Graph)5 GraphCsvReader (org.apache.flink.graph.GraphCsvReader)5