提交 a50eb73e 编写于 作者: V vasia

[FLINK-3181] [gelly] avoid unnecessary messages in SSSP examples and library method

This closes #1467
上级 f7b113d9
......@@ -113,11 +113,13 @@ object SingleSourceShortestPaths {
MessagingFunction[Long, Double, Double, Double] {
override def sendMessages(vertex: Vertex[Long, Double]) {
if (vertex.getValue < Double.PositiveInfinity) {
for (edge: Edge[Long, Double] <- getEdges) {
sendMessageTo(edge.getTarget, vertex.getValue + edge.getValue)
}
}
}
}
// ****************************************************************************
// UTIL METHODS
......
......@@ -135,11 +135,13 @@ public class SingleSourceShortestPaths implements ProgramDescription {
@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());
}
}
}
}
// ******************************************************************************************************************
// UTIL METHODS
......
......@@ -108,11 +108,12 @@ public class SingleSourceShortestPaths<K> implements GraphAlgorithm<K, Double, D
public static final class MinDistanceMessenger<K> extends MessagingFunction<K, Double, Double, Double> {
@Override
public void sendMessages(Vertex<K, Double> vertex)
throws Exception {
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());
}
}
}
}
}
\ No newline at end of file
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册