org.apache.flink.graph.Vertex.<init>()方法的使用及代码示例

x33g5p2x  于2022-02-01 转载在 其他  
字(7.6k)|赞(0)|评价(0)|浏览(97)

本文整理了Java中org.apache.flink.graph.Vertex.<init>()方法的一些代码示例,展示了Vertex.<init>()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Vertex.<init>()方法的具体详情如下:
包路径:org.apache.flink.graph.Vertex
类名称:Vertex
方法名:<init>

Vertex.<init>介绍

暂无

代码示例

代码示例来源:origin: apache/flink

public Vertex<K, VV> getSrcVertex() {
  return new Vertex<>(this.f0, this.f2);
}

代码示例来源:origin: apache/flink

public Vertex<K, VV> getTrgVertex() {
  return new Vertex<>(this.f1, this.f3);
}

代码示例来源:origin: apache/flink

public static final DataSet<Vertex<Long, Long>> getTieVertexSet(ExecutionEnvironment env) {
  List<Vertex<Long, Long>> vertices = new ArrayList<>();
  vertices.add(new Vertex<>(1L, 10L));
  vertices.add(new Vertex<>(2L, 10L));
  vertices.add(new Vertex<>(3L, 10L));
  vertices.add(new Vertex<>(4L, 10L));
  vertices.add(new Vertex<>(5L, 0L));
  vertices.add(new Vertex<>(6L, 20L));
  vertices.add(new Vertex<>(7L, 20L));
  vertices.add(new Vertex<>(8L, 20L));
  vertices.add(new Vertex<>(9L, 20L));
  return env.fromCollection(vertices);
}

代码示例来源:origin: apache/flink

public static final DataSet<Vertex<Long, Long>> getDefaultVertexSet(ExecutionEnvironment env) {
  List<Vertex<Long, Long>> vertices = new ArrayList<>();
  vertices.add(new Vertex<>(1L, 10L));
  vertices.add(new Vertex<>(2L, 10L));
  vertices.add(new Vertex<>(3L, 30L));
  vertices.add(new Vertex<>(4L, 40L));
  vertices.add(new Vertex<>(5L, 40L));
  vertices.add(new Vertex<>(6L, 40L));
  vertices.add(new Vertex<>(7L, 40L));
  return env.fromCollection(vertices);
}

代码示例来源:origin: apache/flink

public static DataSet<Vertex<Long, Double>> getDefaultVertexDataSet(ExecutionEnvironment env) {
  List<Vertex<Long, Double>> vertices = new ArrayList<>();
  vertices.add(new Vertex<>(1L, 6.0));
  vertices.add(new Vertex<>(2L, 2.0));
  vertices.add(new Vertex<>(3L, 3.0));
  vertices.add(new Vertex<>(4L, 1.0));
  vertices.add(new Vertex<>(5L, 0.0));
  return env.fromCollection(vertices);
}

代码示例来源:origin: apache/flink

/**
 * Creates a set of vertices with attached {@link String} values.
 *
 * @param env execution environment
 * @return vertex data set with string values
 */
public static DataSet<Vertex<Long, String>> getVertices(ExecutionEnvironment env) {
  List<Vertex<Long, String>> vertices = new ArrayList<>(INPUT_VERTICES.length);
  for (String vertex : INPUT_VERTICES) {
    String[] tokens = vertex.split(";");
    vertices.add(new Vertex<>(Long.parseLong(tokens[0]), tokens[1]));
  }
  return env.fromCollection(vertices);
}

代码示例来源:origin: apache/flink

public static DataSet<Vertex<Long, EuclideanGraphWeighing.Point>> getDefaultVertexDataSet(ExecutionEnvironment env) {
  List<Vertex<Long, EuclideanGraphWeighing.Point>> vertices = new ArrayList<>();
  for (int i = 1; i <= NUM_VERTICES; i++) {
    vertices.add(new Vertex<>(new Long(i),
      new EuclideanGraphWeighing.Point(new Double(i), new Double(i))));
  }
  return env.fromCollection(vertices);
}

代码示例来源:origin: apache/flink

@Override
  public void coGroup(Iterable<Vertex<K, VV>> vertices,
      Iterable<Tuple2<K, T>> input, Collector<Vertex<K, VV>> collector) throws Exception {
    final Iterator<Vertex<K, VV>> vertexIterator = vertices.iterator();
    final Iterator<Tuple2<K, T>> inputIterator = input.iterator();
    if (vertexIterator.hasNext()) {
      if (inputIterator.hasNext()) {
        final Tuple2<K, T> inputNext = inputIterator.next();
        collector.collect(new Vertex<>(inputNext.f0, vertexJoinFunction
            .vertexJoin(vertexIterator.next().f1, inputNext.f1)));
      } else {
        collector.collect(vertexIterator.next());
      }
    }
  }
}

代码示例来源:origin: apache/flink

@Override
  public Vertex<Long, Point> map(Tuple3<Long, Double, Double> value) throws Exception {
    return new Vertex<>(value.f0, new Point(value.f1, value.f2));
  }
});

代码示例来源:origin: apache/flink

void init(IterationRuntimeContext context) {
  this.runtimeContext = context;
  this.outVertex = new Vertex<>();
  this.outMsg = new Tuple2<>();
  this.edgeIterator = new EdgesIterator<>();
}

代码示例来源:origin: apache/flink

public Vertex<K, VV> map(Vertex<K, Tuple3<VV, LongValue, LongValue>> vertex) {
    return new Vertex<>(vertex.getId(), vertex.getValue().f0);
  }
});

代码示例来源:origin: apache/flink

/**
   * In order to hide the Tuple3(actualValue, inDegree, OutDegree) vertex value from the user,
   * another function will be called from {@link org.apache.flink.graph.spargel.ScatterGatherIteration}.
   *
   * <p>This function will retrieve the vertex from the vertexState and will set its degrees, afterwards calling
   * the regular updateVertex function.
   *
   * @param vertexState
   * @param inMessages
   * @throws Exception
   */
  @SuppressWarnings("unchecked")
  <VertexWithDegree> void updateVertexFromScatterGatherIteration(Vertex<K, VertexWithDegree> vertexState,
                        MessageIterator<Message> inMessages) throws Exception {

    Vertex<K, VV> vertex = new Vertex<>(vertexState.f0,
      ((Tuple3<VV, Long, Long>) vertexState.getValue()).f0);

    updateVertex(vertex, inMessages);
  }
}

代码示例来源:origin: apache/flink

public Vertex<K, Tuple2<Long, Double>> map(Vertex<K, Long> vertex) {
    return new Vertex<>(vertex.getId(), new Tuple2<>(vertex.getValue(), 1.0));
  }
}

代码示例来源:origin: apache/flink

@Override
  public Vertex<K, VertexValue<VV>> map(VertexGroupItem<K, VV> value) throws Exception {
    K vertexId = value.getVertexId();
    reuseSummarizedVertexValue.setVertexGroupValue(value.getVertexGroupValue());
    reuseSummarizedVertexValue.setVertexGroupCount(value.getVertexGroupCount());
    return new Vertex<>(vertexId, reuseSummarizedVertexValue);
  }
}

代码示例来源:origin: apache/flink

@Override
  public void join(Vertex<K, VV> vertex, Tuple3<K, LongValue, LongValue> degrees,
          Collector<Vertex<K, Tuple3<VV, LongValue, LongValue>>> out) throws Exception {
    out.collect(new Vertex<>(vertex.getId(),
          new Tuple3<>(vertex.getValue(), degrees.f1, degrees.f2)));
  }
}).withForwardedFieldsFirst("f0");

代码示例来源:origin: apache/flink

/**
 * Apply a function to the attribute of each vertex in the graph.
 *
 * @param mapper the map function to apply.
 * @param returnType the explicit return type.
 * @return a new graph
 */
public <NV> Graph<K, NV, EV> mapVertices(final MapFunction<Vertex<K, VV>, NV> mapper, TypeInformation<Vertex<K, NV>> returnType) {
  DataSet<Vertex<K, NV>> mappedVertices = vertices.map(
      new MapFunction<Vertex<K, VV>, Vertex<K, NV>>() {
        private Vertex<K, NV> output = new Vertex<>();
        public Vertex<K, NV> map(Vertex<K, VV> value) throws Exception {
          output.f0 = value.f0;
          output.f1 = mapper.map(value);
          return output;
        }
      })
      .returns(returnType)
      .withForwardedFields("f0")
        .name("Map vertices");
  return new Graph<>(mappedVertices, this.edges, this.context);
}

代码示例来源:origin: apache/flink

.name("IDs")
.map(new MapFunction<Tuple1<K>, Vertex<K, VV>>() {
  private Vertex<K, VV> output = new Vertex<>();

代码示例来源:origin: org.gradoop/gradoop-flink

/**
 * Constructor.
 */
public VertexToGellyVertexWithGradoopId() {
 reuseVertex = new org.apache.flink.graph.Vertex<>();
}

代码示例来源:origin: vasia/gelly-streaming

@Override
  public void flatMap(Edge<K, EV> edge, Collector<Vertex<K, NullValue>> out) throws Exception {
    out.collect(new Vertex<>(edge.getSource(), NullValue.getInstance()));
    out.collect(new Vertex<>(edge.getTarget(), NullValue.getInstance()));
  }
}

代码示例来源:origin: com.alibaba.blink/flink-gelly

@Override
  public void join(Vertex<K, VV> vertex, Tuple3<K, LongValue, LongValue> degrees,
          Collector<Vertex<K, Tuple3<VV, LongValue, LongValue>>> out) throws Exception {
    out.collect(new Vertex<>(vertex.getId(),
          new Tuple3<>(vertex.getValue(), degrees.f1, degrees.f2)));
  }
}).withForwardedFieldsFirst("f0");

相关文章