本文整理汇总了Java中org.apache.flink.graph.Vertex.getId方法的典型用法代码示例。如果您正苦于以下问题:Java Vertex.getId方法的具体用法?Java Vertex.getId怎么用?Java Vertex.getId使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.flink.graph.Vertex
的用法示例。
在下文中一共展示了Vertex.getId方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: reduce
import org.apache.flink.graph.Vertex; //导入方法依赖的package包/类
@Override
public void reduce(Iterable<Vertex<K, VV>> values, Collector<VertexGroupItem<K, VV>> out) throws Exception {
K vertexGroupRepresentativeID = null;
long vertexGroupCount = 0L;
VV vertexGroupValue = null;
boolean isFirstElement = true;
for (Vertex<K, VV> vertex : values) {
if (isFirstElement) {
// take final group representative vertex id from first tuple
vertexGroupRepresentativeID = vertex.getId();
vertexGroupValue = vertex.getValue();
isFirstElement = false;
}
// no need to set group value for those tuples
reuseVertexGroupItem.setVertexId(vertex.getId());
reuseVertexGroupItem.setGroupRepresentativeId(vertexGroupRepresentativeID);
out.collect(reuseVertexGroupItem);
vertexGroupCount++;
}
createGroupRepresentativeTuple(vertexGroupRepresentativeID, vertexGroupValue, vertexGroupCount);
out.collect(reuseVertexGroupItem);
reuseVertexGroupItem.reset();
}
示例2: Projection
import org.apache.flink.graph.Vertex; //导入方法依赖的package包/类
public Projection(
Vertex<KC, VVC> connectingVertex,
VV sourceVertexValue, VV targetVertexValue,
EV sourceEdgeValue, EV targetEdgeValue) {
this.f0 = connectingVertex.getId();
this.f1 = connectingVertex.getValue();
this.f2 = sourceVertexValue;
this.f3 = targetVertexValue;
this.f4 = sourceEdgeValue;
this.f5 = targetEdgeValue;
}
示例3: iterateNeighbors
import org.apache.flink.graph.Vertex; //导入方法依赖的package包/类
@Override
public void iterateNeighbors(Vertex<Long, Long> vertex,
Iterable<Tuple2<Edge<Long, Long>, Vertex<Long, Long>>> neighbors,
Collector<Tuple2<Long, Long>> out) throws Exception {
long sum = 0;
for (Tuple2<Edge<Long, Long>, Vertex<Long, Long>> neighbor : neighbors) {
sum += neighbor.f1.getValue();
}
if (vertex.getId() > 3) {
out.collect(new Tuple2<>(vertex.getId(), sum));
}
}
示例4: sendMessages
import org.apache.flink.graph.Vertex; //导入方法依赖的package包/类
@Override
public void sendMessages(Vertex<Long, Long> vertex) {
if (vertex.getId() == 1) {
Assert.assertEquals(2, getOutDegree());
Assert.assertEquals(1, getInDegree());
} else if (vertex.getId() == 3) {
Assert.assertEquals(2, getOutDegree());
Assert.assertEquals(2, getInDegree());
}
//send message to keep vertices active
sendMessageToAllNeighbors(vertex.getValue());
}
示例5: map
import org.apache.flink.graph.Vertex; //导入方法依赖的package包/类
public Tuple2<K, Either<NullValue, Message>> map(Vertex<K, VV> vertex) {
outTuple.f0 = vertex.getId();
return outTuple;
}
示例6: map
import org.apache.flink.graph.Vertex; //导入方法依赖的package包/类
public Vertex<K, Tuple2<Long, Double>> map(Vertex<K, Long> vertex) {
return new Vertex<>(vertex.getId(), new Tuple2<>(vertex.getValue(), 1.0));
}
示例7: map
import org.apache.flink.graph.Vertex; //导入方法依赖的package包/类
public Tuple2<Long, Boolean> map(Vertex<Long, Long> vertex) throws Exception {
return new Tuple2<>(vertex.getId(), true);
}