Search in sources :

Example 6 with LongValueSequenceIterator

use of org.apache.flink.util.LongValueSequenceIterator in project flink by apache.

the class StarGraph method generate.

@Override
public Graph<LongValue, NullValue, NullValue> generate() {
    Preconditions.checkState(vertexCount >= 2);
    // Vertices
    DataSet<Vertex<LongValue, NullValue>> vertices = GraphGeneratorUtils.vertexSequence(env, parallelism, vertexCount);
    // Edges
    LongValueSequenceIterator iterator = new LongValueSequenceIterator(1, this.vertexCount - 1);
    DataSet<Edge<LongValue, NullValue>> edges = env.fromParallelCollection(iterator, LongValue.class).setParallelism(parallelism).name("Edge iterators").flatMap(new LinkVertexToCenter()).setParallelism(parallelism).name("Star graph edges");
    // Graph
    return Graph.fromDataSet(vertices, edges, env);
}
Also used : LongValueSequenceIterator(org.apache.flink.util.LongValueSequenceIterator) Vertex(org.apache.flink.graph.Vertex) LongValue(org.apache.flink.types.LongValue) Edge(org.apache.flink.graph.Edge)

Aggregations

LongValue (org.apache.flink.types.LongValue)6 LongValueSequenceIterator (org.apache.flink.util.LongValueSequenceIterator)6 Edge (org.apache.flink.graph.Edge)5 Vertex (org.apache.flink.graph.Vertex)5 TypeHint (org.apache.flink.api.common.typeinfo.TypeHint)1 NullValue (org.apache.flink.types.NullValue)1