当前位置: 首页>>代码示例>>Java>>正文


Java Vertex.getId方法代码示例

本文整理汇总了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();
}
 
开发者ID:axbaretto,项目名称:flink,代码行数:26,代码来源:Summarization.java

示例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;
}
 
开发者ID:axbaretto,项目名称:flink,代码行数:12,代码来源:Projection.java

示例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));
	}
}
 
开发者ID:axbaretto,项目名称:flink,代码行数:14,代码来源:ReduceOnNeighborMethodsITCase.java

示例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());
}
 
开发者ID:axbaretto,项目名称:flink,代码行数:13,代码来源:ScatterGatherConfigurationITCase.java

示例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;
}
 
开发者ID:axbaretto,项目名称:flink,代码行数:5,代码来源:VertexCentricIteration.java

示例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));
}
 
开发者ID:axbaretto,项目名称:flink,代码行数:4,代码来源:CommunityDetection.java

示例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);
}
 
开发者ID:axbaretto,项目名称:flink,代码行数:4,代码来源:JoinWithVerticesITCase.java


注:本文中的org.apache.flink.graph.Vertex.getId方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。