Examples of generateSequence()


Examples of org.apache.flink.api.java.ExecutionEnvironment.generateSequence()

    final int numVertices = 100;
   
    ExecutionEnvironment env = ExecutionEnvironment.getExecutionEnvironment();
   
    // enumerate some sample edges and assign an initial uniform probability (rank)
    DataSet<Tuple2<Long, Double>> intialRanks = env.generateSequence(1, numVertices)
                .map(new MapFunction<Long, Tuple2<Long, Double>>() {
                  public Tuple2<Long, Double> map(Long value) {
                    return new Tuple2<Long, Double>(value, 1.0/numVertices);
                  }
                });
View Full Code Here

Examples of org.apache.flink.api.java.ExecutionEnvironment.generateSequence()

                    return new Tuple2<Long, Double>(value, 1.0/numVertices);
                  }
                });
   
    // generate some random edges. the transition probability on each edge is 1/num-out-edges of the source vertex
    DataSet<Tuple3<Long, Long, Double>> edgesWithProbability = env.generateSequence(1, numVertices)
                .flatMap(new FlatMapFunction<Long, Tuple3<Long, Long, Double>>() {
                  public void flatMap(Long value, Collector<Tuple3<Long, Long, Double>> out) {
                    int numOutEdges = (int) (Math.random() * (numVertices / 2));
                    for (int i = 0; i < numOutEdges; i++) {
                      long target = (long) (Math.random() * numVertices) + 1;
View Full Code Here

Examples of org.apache.flink.api.java.ExecutionEnvironment.generateSequence()

public class SpargelConnectedComponents {

  public static void main(String[] args) throws Exception {
    ExecutionEnvironment env = ExecutionEnvironment.getExecutionEnvironment();
   
    DataSet<Long> vertexIds = env.generateSequence(0, 10);
    DataSet<Tuple2<Long, Long>> edges = env.fromElements(new Tuple2<Long, Long>(0L, 2L), new Tuple2<Long, Long>(2L, 4L), new Tuple2<Long, Long>(4L, 8L),
                              new Tuple2<Long, Long>(1L, 5L), new Tuple2<Long, Long>(3L, 7L), new Tuple2<Long, Long>(3L, 9L));
   
    DataSet<Tuple2<Long, Long>> initialVertices = vertexIds.map(new IdAssigner());
   
View Full Code Here

Examples of org.apache.flink.api.java.ExecutionEnvironment.generateSequence()

    final int NUM_VERTICES = 100;
   
    ExecutionEnvironment env = ExecutionEnvironment.getExecutionEnvironment();
   
    // a list of vertices
    DataSet<Long> vertices = env.generateSequence(1, NUM_VERTICES);
   
    // generate some random edges. the transition probability on each edge is 1/num-out-edges of the source vertex
    DataSet<Tuple3<Long, Long, Double>> edgesWithProbability = env.generateSequence(1, NUM_VERTICES)
                .flatMap(new FlatMapFunction<Long, Tuple3<Long, Long, Double>>() {
                  public void flatMap(Long value, Collector<Tuple3<Long, Long, Double>> out) {
View Full Code Here

Examples of org.apache.flink.api.java.ExecutionEnvironment.generateSequence()

   
    // a list of vertices
    DataSet<Long> vertices = env.generateSequence(1, NUM_VERTICES);
   
    // generate some random edges. the transition probability on each edge is 1/num-out-edges of the source vertex
    DataSet<Tuple3<Long, Long, Double>> edgesWithProbability = env.generateSequence(1, NUM_VERTICES)
                .flatMap(new FlatMapFunction<Long, Tuple3<Long, Long, Double>>() {
                  public void flatMap(Long value, Collector<Tuple3<Long, Long, Double>> out) {
                    int numOutEdges = (int) (Math.random() * (NUM_VERTICES / 2));
                    for (int i = 0; i < numOutEdges; i++) {
                      long target = (long) (Math.random() * NUM_VERTICES) + 1;
View Full Code Here

Examples of org.apache.flink.api.java.ExecutionEnvironment.generateSequence()

         */
   
        final ExecutionEnvironment env = ExecutionEnvironment.getExecutionEnvironment();

        // generate some number in parallel
        DataSet<Long> ds = env.generateSequence(1,3000);
        DataSet<Tuple2<Integer, Integer>> uniqLongs = ds
            // introduce some partition skew by filtering
            .filter(new FilterFunction<Long>() {
              private static final long serialVersionUID = 1L;

View Full Code Here

Examples of org.apache.flink.api.java.ExecutionEnvironment.generateSequence()

    try {
      ExecutionEnvironment env = ExecutionEnvironment.getExecutionEnvironment();
      env.setDegreeOfParallelism(DEFAULT_PARALLELISM);
      // compose test program
      {
        DataSet<Long> vertexIds = env.generateSequence(1, 2);
       
        @SuppressWarnings("unchecked")
        DataSet<Tuple2<Long, Long>> edges = env.fromElements(new Tuple2<Long, Long>(1L, 2L));
       
        DataSet<Tuple2<Long, Long>> initialVertices = vertexIds.map(new IdAssigner());
View Full Code Here

Examples of org.apache.flink.api.java.ExecutionEnvironment.generateSequence()

      env.setDegreeOfParallelism(DEFAULT_PARALLELISM);
      // compose test program
      {
        DataSet<Long> bcVar = env.fromElements(1L);
       
        DataSet<Long> vertexIds = env.generateSequence(1, 2);
       
        @SuppressWarnings("unchecked")
        DataSet<Tuple2<Long, Long>> edges = env.fromElements(new Tuple2<Long, Long>(1L, 2L));
       
        DataSet<Tuple2<Long, Long>> initialVertices = vertexIds.map(new IdAssigner());
View Full Code Here

Examples of org.apache.flink.api.java.ExecutionEnvironment.generateSequence()

      final List<Tuple2<Long, Long>> result = new ArrayList<Tuple2<Long,Long>>();
     
      ExecutionEnvironment env = ExecutionEnvironment.getExecutionEnvironment();
      env.setDegreeOfParallelism(1);
     
      DataSet<Tuple2<Long, Long>> input = env.generateSequence(0, 9).map(new Duplicator<Long>());
     
      DeltaIteration<Tuple2<Long, Long>, Tuple2<Long, Long>> iteration = input.iterateDelta(input, 5, 1);
     
      iteration.closeWith(iteration.getWorkset(), iteration.getWorkset().map(new TestMapper()))
        .output(new LocalCollectionOutputFormat<Tuple2<Long,Long>>(result));
View Full Code Here

Examples of org.apache.flink.api.java.ExecutionEnvironment.generateSequence()

 
  @Override
  protected void testProgram() throws Exception {
    ExecutionEnvironment env = ExecutionEnvironment.getExecutionEnvironment();
   
    DataSet<Long> vertexIds = env.generateSequence(1, NUM_VERTICES);
    DataSet<String> edgeString = env.fromElements(ConnectedComponentsData.getRandomOddEvenEdges(NUM_EDGES, NUM_VERTICES, SEED).split("\n"));
   
    DataSet<Tuple2<Long, Long>> edges = edgeString.map(new EdgeParser());
   
    DataSet<Tuple2<Long, Long>> initialVertices = vertexIds.map(new IdAssigner());
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.