org.apache.giraph.graph.Vertex.isHalted()方法的使用及代码示例

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

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

Vertex.isHalted介绍

[英]Is this vertex done?
[中]完成了吗?

代码示例

代码示例来源:origin: org.apache.giraph/giraph-core

  1. /**
  2. * Writes vertex data (Id, value and halted state) to stream.
  3. *
  4. * @param output The output stream
  5. * @param vertex The vertex to serialize
  6. * @throws IOException
  7. */
  8. private void writeVertexData(DataOutput output, Vertex<I, V, E> vertex)
  9. throws IOException {
  10. vertex.getId().write(output);
  11. V value = vertex.getValue();
  12. if (value != null) {
  13. output.writeBoolean(false);
  14. value.write(output);
  15. } else {
  16. output.writeBoolean(true);
  17. }
  18. output.writeBoolean(vertex.isHalted());
  19. }

代码示例来源:origin: org.apache.giraph/giraph-examples

  1. @Override
  2. public void compute(
  3. Vertex<LongWritable, IntWritable, FloatWritable> vertex,
  4. Iterable<IntWritable> messages) throws IOException {
  5. // Some checks for additional testing
  6. if (getTotalNumVertices() < 1) {
  7. throw new IllegalStateException("compute: Illegal total vertices " +
  8. getTotalNumVertices());
  9. }
  10. if (getTotalNumEdges() < 0) {
  11. throw new IllegalStateException("compute: Illegal total edges " +
  12. getTotalNumEdges());
  13. }
  14. if (vertex.isHalted()) {
  15. throw new IllegalStateException("compute: Impossible to be halted - " +
  16. vertex.isHalted());
  17. }
  18. if (getSuperstep() > 3) {
  19. vertex.voteToHalt();
  20. }
  21. }

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

  1. Iterable messages =
  2. internalApi.takeMessages(vertex.getId());
  3. if (vertex.isHalted() && !Iterables.isEmpty(messages)) {
  4. vertex.wakeUp();
  5. if (!vertex.isHalted()) {
  6. localLogic.compute(vertex, messages);
  7. if (!vertex.isHalted()) {
  8. anyCurVertexAlive = true;

代码示例来源:origin: org.apache.giraph/giraph-core

  1. /**
  2. * Writes Vertex data to output stream.
  3. *
  4. * @param output the output stream
  5. * @param vertex The vertex to serialize
  6. * @param conf Configuration
  7. * @param <I> Vertex id
  8. * @param <V> Vertex value
  9. * @param <E> Edge value
  10. * @throws IOException
  11. */
  12. @SuppressWarnings("unchecked")
  13. public static <I extends WritableComparable, V extends Writable,
  14. E extends Writable> void writeVertexToDataOutput(
  15. DataOutput output,
  16. Vertex<I, V, E> vertex,
  17. ImmutableClassesGiraphConfiguration<I, V, E> conf)
  18. throws IOException {
  19. vertex.getId().write(output);
  20. vertex.getValue().write(output);
  21. ((OutEdges<I, E>) vertex.getEdges()).write(output);
  22. output.writeBoolean(vertex.isHalted());
  23. }

代码示例来源:origin: org.apache.giraph/giraph-core

  1. if (vertex.isHalted() && !Iterables.isEmpty(messages)) {
  2. vertex.wakeUp();
  3. if (!vertex.isHalted()) {
  4. context.progress();
  5. computation.compute(vertex, messages);
  6. if (vertex.isHalted()) {
  7. partitionStats.incrFinishedVertexCount();

相关文章