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

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

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

Vertex.getValue介绍

暂无

代码示例

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

@Override
  public Long map(Vertex<K, Tuple2<Long, Double>> vertex) throws Exception {
    return vertex.getValue().f0;
  }
}

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

@Override
public void sendMessages(Vertex<K, VV> vertex) throws Exception {
  // send current minimum to neighbors
  sendMessageToAllNeighbors(vertex.getValue());
}

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

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;
}

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

@Override
  public void updateVertex(Vertex<Long, Double> vertex, MessageIterator<Double> inMessages) {
    Double minDistance = Double.MAX_VALUE;
    for (double msg : inMessages) {
      if (msg < minDistance) {
        minDistance = msg;
      }
    }
    if (vertex.getValue() > minDistance) {
      setNewVertexValue(minDistance);
    }
  }
}

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

@Override
  public void join(Tuple4<K, K, VV, EV> tripletWithSrcValSet,
          Vertex<K, VV> vertex, Collector<Triplet<K, VV, EV>> collector) throws Exception {
    collector.collect(new Triplet<>(tripletWithSrcValSet.f0, tripletWithSrcValSet.f1,
        tripletWithSrcValSet.f2, vertex.getValue(), tripletWithSrcValSet.f3));
  }
}

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

@Override
public void join(Tuple2<K, M> newValue, final Vertex<K, VV> currentValue, final Collector<Vertex<K, VV>> out) throws Exception {
  this.applyFunction.setOutput(currentValue, out);
  this.applyFunction.apply(newValue.f1, currentValue.getValue());
}

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

public void join(Tuple3<K, K, Edge<K, EV>> keysWithEdge, Vertex<K, VV> neighbor,
      Collector<Tuple2<K, VV>> out) {
    out.collect(new Tuple2<>(keysWithEdge.f0, neighbor.getValue()));
  }
}

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

@Override
  public void sendMessages(Vertex<K, Double> vertex) {
    if (vertex.getValue() < Double.POSITIVE_INFINITY) {
      for (Edge<K, Double> edge : getEdges()) {
        sendMessageTo(edge.getTarget(), vertex.getValue() + edge.getValue());
      }
    }
  }
}

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

@Override
  public void sendMessages(Vertex<Long, Double> vertex) {
    if (vertex.getValue() < Double.POSITIVE_INFINITY) {
      for (Edge<Long, Double> edge : getEdges()) {
        sendMessageTo(edge.getTarget(), vertex.getValue() + edge.getValue());
      }
    }
  }
}

代码示例来源: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

@Override
  public void sendMessages(Vertex<K, Tuple2<Long, Double>> vertex) throws Exception {
    for (Edge<K, Double> edge : getEdges()) {
      sendMessageTo(edge.getTarget(), new Tuple2<>(vertex.getValue().f0,
        vertex.getValue().f1 * edge.getValue()));
    }
  }
}

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

@SuppressWarnings("unchecked")
  public void join(Edge<K, EV> edge, Vertex<K, VV> otherVertex,
      Collector<Tuple2<K, VV>> out) {
    out.collect(new Tuple2<>((K) edge.getField(fieldPosition), otherVertex.getValue()));
  }
}

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

@Override
  public Tuple3<Long, Long, Double> map(Triplet<Long, Point, Double> triplet)
      throws Exception {
    Vertex<Long, Point> srcVertex = triplet.getSrcVertex();
    Vertex<Long, Point> trgVertex = triplet.getTrgVertex();
    return new Tuple3<>(srcVertex.getId(), trgVertex.getId(),
      srcVertex.getValue().euclideanDistance(trgVertex.getValue()));
  }
});

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

public void compute(Vertex<Long, Double> vertex, MessageIterator<Double> messages) {
    double minDistance = (vertex.getId().equals(srcId)) ? 0d : Double.POSITIVE_INFINITY;
    for (Double msg : messages) {
      minDistance = Math.min(minDistance, msg);
    }
    if (minDistance < vertex.getValue()) {
      setNewVertexValue(minDistance);
      for (Edge<Long, Double> e: getEdges()) {
        sendMessageTo(e.getTarget(), minDistance + e.getValue());
      }
    }
  }
}

代码示例来源: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 void join(Vertex<K, VV> vertex, Edge<K, EV> edge, Collector<Tuple4<K, K, VV, EV>> collector)
      throws Exception {
    collector.collect(new Tuple4<>(edge.getSource(), edge.getTarget(), vertex.getValue(),
        edge.getValue()));
  }
}

代码示例来源: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

public void join(Vertex<K, VV> vertex, Edge<K, EV> edge, Collector<Tuple2<K, Neighbor<VV, EV>>> out) {
    out.collect(new Tuple2<>(
        edge.getTarget(), new Neighbor<>(vertex.getValue(), edge.getValue())));
  }
}

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

public void join(Vertex<K, VV> vertex, Edge<K, EV> edge, Collector<Tuple2<K, Neighbor<VV, EV>>> out) {
    out.collect(new Tuple2<>(
        edge.getSource(), new Neighbor<>(vertex.getValue(), edge.getValue())));
  }
}

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

@Override
  public void sendMessages(Vertex<K, Double> vertex) {
    if (getSuperstepNumber() == 1) {
      // initialize vertex ranks
      vertex.setValue(1.0 / this.getNumberOfVertices());
    }
    for (Edge<K, Double> edge : getEdges()) {
      sendMessageTo(edge.getTarget(), vertex.getValue() * edge.getValue());
    }
  }
}

相关文章