flink-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From va...@apache.org
Subject [2/2] flink git commit: [FLINK-1633] [gelly] some cosmetic changes to getTriplets and EuclideanGraphExample
Date Mon, 30 Mar 2015 09:53:21 GMT
[FLINK-1633] [gelly] some cosmetic changes to getTriplets and EuclideanGraphExample

This closes #452


Project: http://git-wip-us.apache.org/repos/asf/flink/repo
Commit: http://git-wip-us.apache.org/repos/asf/flink/commit/01adab53
Tree: http://git-wip-us.apache.org/repos/asf/flink/tree/01adab53
Diff: http://git-wip-us.apache.org/repos/asf/flink/diff/01adab53

Branch: refs/heads/master
Commit: 01adab53a53ab79a95ab14b4f86e94fd78c0fa40
Parents: 2f66ab3
Author: vasia <vasilikikalavri@gmail.com>
Authored: Sun Mar 29 19:52:44 2015 +0200
Committer: Vasia Kalavri <vasia@apache.org>
Committed: Mon Mar 30 11:50:54 2015 +0200

----------------------------------------------------------------------
 .../src/main/java/org/apache/flink/graph/Triplet.java       | 2 ++
 .../apache/flink/graph/example/EuclideanGraphExample.java   | 9 +++------
 2 files changed, 5 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/flink/blob/01adab53/flink-staging/flink-gelly/src/main/java/org/apache/flink/graph/Triplet.java
----------------------------------------------------------------------
diff --git a/flink-staging/flink-gelly/src/main/java/org/apache/flink/graph/Triplet.java b/flink-staging/flink-gelly/src/main/java/org/apache/flink/graph/Triplet.java
index a0ebb13..b85987d 100644
--- a/flink-staging/flink-gelly/src/main/java/org/apache/flink/graph/Triplet.java
+++ b/flink-staging/flink-gelly/src/main/java/org/apache/flink/graph/Triplet.java
@@ -33,6 +33,8 @@ import java.io.Serializable;
 public class Triplet <K extends Comparable<K> & Serializable, VV extends Serializable,
EV extends Serializable>
 		extends Tuple5<K, K, VV, VV, EV> {
 
+	private static final long serialVersionUID = 1L;
+
 	public Triplet() {}
 
 	/**

http://git-wip-us.apache.org/repos/asf/flink/blob/01adab53/flink-staging/flink-gelly/src/main/java/org/apache/flink/graph/example/EuclideanGraphExample.java
----------------------------------------------------------------------
diff --git a/flink-staging/flink-gelly/src/main/java/org/apache/flink/graph/example/EuclideanGraphExample.java
b/flink-staging/flink-gelly/src/main/java/org/apache/flink/graph/example/EuclideanGraphExample.java
index 10ad629..fa08084 100644
--- a/flink-staging/flink-gelly/src/main/java/org/apache/flink/graph/example/EuclideanGraphExample.java
+++ b/flink-staging/flink-gelly/src/main/java/org/apache/flink/graph/example/EuclideanGraphExample.java
@@ -71,7 +71,7 @@ public class EuclideanGraphExample implements ProgramDescription {
 		Graph<Long, Point, Double> graph = Graph.fromDataSet(vertices, edges, env);
 
 		// the edge value will be the Euclidean distance between its src and trg vertex
-		DataSet<Tuple3<Long, Long, Double>> resultedTriplets = graph.getTriplets()
+		DataSet<Tuple3<Long, Long, Double>> edgesWithEuclideanWeight = graph.getTriplets()
 				.map(new MapFunction<Triplet<Long, Point, Double>, Tuple3<Long, Long, Double>>()
{
 
 					@Override
@@ -80,16 +80,13 @@ public class EuclideanGraphExample implements ProgramDescription {
 
 						Vertex<Long, Point> srcVertex = triplet.getSrcVertex();
 						Vertex<Long, Point> trgVertex = triplet.getTrgVertex();
-						Edge<Long, Double> edge = triplet.getEdge();
-
-						edge.setValue(srcVertex.getValue().euclideanDistance(trgVertex.getValue()));
 
 						return new Tuple3<Long, Long, Double>(srcVertex.getId(), trgVertex.getId(),
-								edge.getValue());
+								srcVertex.getValue().euclideanDistance(trgVertex.getValue()));
 					}
 				});
 
-		Graph<Long, Point, Double> resultedGraph = graph.joinWithEdges(resultedTriplets,
+		Graph<Long, Point, Double> resultedGraph = graph.joinWithEdges(edgesWithEuclideanWeight,
 				new MapFunction<Tuple2<Double, Double>, Double>() {
 
 					@Override


Mime
View raw message