本文整理了Java中org.apache.giraph.graph.Vertex.isHalted()
方法的一些代码示例,展示了Vertex.isHalted()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Vertex.isHalted()
方法的具体详情如下:
包路径:org.apache.giraph.graph.Vertex
类名称:Vertex
方法名:isHalted
[英]Is this vertex done?
[中]完成了吗?
代码示例来源:origin: org.apache.giraph/giraph-core
/**
* Writes vertex data (Id, value and halted state) to stream.
*
* @param output The output stream
* @param vertex The vertex to serialize
* @throws IOException
*/
private void writeVertexData(DataOutput output, Vertex<I, V, E> vertex)
throws IOException {
vertex.getId().write(output);
V value = vertex.getValue();
if (value != null) {
output.writeBoolean(false);
value.write(output);
} else {
output.writeBoolean(true);
}
output.writeBoolean(vertex.isHalted());
}
代码示例来源:origin: org.apache.giraph/giraph-examples
@Override
public void compute(
Vertex<LongWritable, IntWritable, FloatWritable> vertex,
Iterable<IntWritable> messages) throws IOException {
// Some checks for additional testing
if (getTotalNumVertices() < 1) {
throw new IllegalStateException("compute: Illegal total vertices " +
getTotalNumVertices());
}
if (getTotalNumEdges() < 0) {
throw new IllegalStateException("compute: Illegal total edges " +
getTotalNumEdges());
}
if (vertex.isHalted()) {
throw new IllegalStateException("compute: Impossible to be halted - " +
vertex.isHalted());
}
if (getSuperstep() > 3) {
vertex.voteToHalt();
}
}
代码示例来源:origin: apache/giraph
Iterable messages =
internalApi.takeMessages(vertex.getId());
if (vertex.isHalted() && !Iterables.isEmpty(messages)) {
vertex.wakeUp();
if (!vertex.isHalted()) {
localLogic.compute(vertex, messages);
if (!vertex.isHalted()) {
anyCurVertexAlive = true;
代码示例来源:origin: org.apache.giraph/giraph-core
/**
* Writes Vertex data to output stream.
*
* @param output the output stream
* @param vertex The vertex to serialize
* @param conf Configuration
* @param <I> Vertex id
* @param <V> Vertex value
* @param <E> Edge value
* @throws IOException
*/
@SuppressWarnings("unchecked")
public static <I extends WritableComparable, V extends Writable,
E extends Writable> void writeVertexToDataOutput(
DataOutput output,
Vertex<I, V, E> vertex,
ImmutableClassesGiraphConfiguration<I, V, E> conf)
throws IOException {
vertex.getId().write(output);
vertex.getValue().write(output);
((OutEdges<I, E>) vertex.getEdges()).write(output);
output.writeBoolean(vertex.isHalted());
}
代码示例来源:origin: org.apache.giraph/giraph-core
if (vertex.isHalted() && !Iterables.isEmpty(messages)) {
vertex.wakeUp();
if (!vertex.isHalted()) {
context.progress();
computation.compute(vertex, messages);
if (vertex.isHalted()) {
partitionStats.incrFinishedVertexCount();
内容来源于网络,如有侵权,请联系作者删除!