[GitHub] flink pull request: [FLINK-1633][gelly] Added getTriplets() method...
Github user asfgit closed the pull request at: https://github.com/apache/flink/pull/452 --- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. ---
[GitHub] flink pull request: [FLINK-1633][gelly] Added getTriplets() method...
Github user vasia commented on the pull request: https://github.com/apache/flink/pull/452#issuecomment-87615727 Thanks @rmetzger! Just a heads up in case you hadn't seen this failure before. Merging :-) --- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. ---
[GitHub] flink pull request: [FLINK-1633][gelly] Added getTriplets() method...
Github user rmetzger commented on the pull request: https://github.com/apache/flink/pull/452#issuecomment-87600209 @vasia: I think the error is not related to the PR and it only happened in one out of 10 builds. Its not good that it failed but it should not block you from merging this PR. --- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. ---
[GitHub] flink pull request: [FLINK-1633][gelly] Added getTriplets() method...
Github user vasia commented on the pull request: https://github.com/apache/flink/pull/452#issuecomment-87475338 Hi, I got the following in my local Travis setup: `Failed tests: ChainTaskTest>TaskTestBase.shutdownMemoryManager:163 Memory Manager managed memory was not completely freed. Tests in error: ChainTaskTest.testFailingMapTask:174 » OutOfMemory Java heap space` This is for oraclejdk8: https://travis-ci.org/vasia/flink/builds/56324549 Not related to this PR, so I guess I can merge...? --- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. ---
[GitHub] flink pull request: [FLINK-1633][gelly] Added getTriplets() method...
Github user andralungu commented on the pull request: https://github.com/apache/flink/pull/452#issuecomment-87269837 @vasia , No need to ignore the hadoop1 failure, I rebased and everything is nice and green now. --- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. ---
[GitHub] flink pull request: [FLINK-1633][gelly] Added getTriplets() method...
Github user vasia commented on the pull request: https://github.com/apache/flink/pull/452#issuecomment-87024583 Ha! This seems like travis is pending but it has actually finished o.O There is the following failure for hadoop1 / openjdk 6: `Failed tests: ProcessFailureBatchRecoveryITCase.testTaskManagerProcessFailure:266 The program encountered a AssertionError : expected:<55> but was:<6239784976>` Shall I ignore it and merge? Thanks! --- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. ---
[GitHub] flink pull request: [FLINK-1633][gelly] Added getTriplets() method...
Github user vasia commented on a diff in the pull request: https://github.com/apache/flink/pull/452#discussion_r26928684 --- Diff: flink-staging/flink-gelly/src/main/java/org/apache/flink/graph/Graph.java --- @@ -53,6 +54,7 @@ import org.apache.flink.graph.utils.Tuple2ToVertexMap; import org.apache.flink.graph.utils.Tuple3ToEdgeMap; import org.apache.flink.graph.utils.VertexToTuple2Map; +import org.apache.flink.graph.utils.Tuple2ToVertexMap; --- End diff -- my bad, it's duplicate --- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. ---
[GitHub] flink pull request: [FLINK-1633][gelly] Added getTriplets() method...
Github user vasia commented on a diff in the pull request: https://github.com/apache/flink/pull/452#discussion_r26928666 --- Diff: flink-staging/flink-gelly/src/main/java/org/apache/flink/graph/Graph.java --- @@ -53,6 +54,7 @@ import org.apache.flink.graph.utils.Tuple2ToVertexMap; import org.apache.flink.graph.utils.Tuple3ToEdgeMap; import org.apache.flink.graph.utils.VertexToTuple2Map; +import org.apache.flink.graph.utils.Tuple2ToVertexMap; --- End diff -- and this import is not used anywhere :-) --- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. ---
[GitHub] flink pull request: [FLINK-1633][gelly] Added getTriplets() method...
Github user vasia commented on a diff in the pull request: https://github.com/apache/flink/pull/452#discussion_r26928420 --- Diff: flink-staging/flink-gelly/src/main/java/org/apache/flink/graph/example/EuclideanGraphExample.java --- @@ -0,0 +1,214 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.flink.graph.example; + +import org.apache.flink.api.common.ProgramDescription; +import org.apache.flink.api.common.functions.MapFunction; +import org.apache.flink.api.java.DataSet; +import org.apache.flink.api.java.ExecutionEnvironment; +import org.apache.flink.api.java.tuple.Tuple2; +import org.apache.flink.api.java.tuple.Tuple3; +import org.apache.flink.graph.Edge; +import org.apache.flink.graph.Graph; +import org.apache.flink.graph.Triplet; +import org.apache.flink.graph.Vertex; +import org.apache.flink.graph.example.utils.EuclideanGraphData; + +import java.io.Serializable; + +/** + * Given a directed, unweighted graph, with vertex values representing points in a plan, + * return a weighted graph where the edge weights are equal to the Euclidean distance between the + * src and the trg vertex values. + * + * + * Input files are plain text files and must be formatted as follows: + * + * Vertices are represented by their vertexIds and vertex values and are separated by newlines, + * the value being formed of two doubles separated by a comma. + * For example: 1,1.0,1.0\n2,2.0,2.0\n3,3.0,3.0\n defines a data set of three vertices + * Edges are represented by triples of srcVertexId, srcEdgeId, weight which are + * separated by commas. Edges themselves are separated by newlines. The initial edge value will be overwritten. --- End diff -- Hey @andralungu! Sorry for not noticing this earlier, but why give a weighted edge as input if you're going to override the weight anyway? And in the beginning of the description, you refer to an unweighted graph. --- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. ---
[GitHub] flink pull request: [FLINK-1633][gelly] Added getTriplets() method...
Github user vasia commented on a diff in the pull request: https://github.com/apache/flink/pull/452#discussion_r26487906 --- Diff: flink-staging/flink-gelly/src/main/java/org/apache/flink/graph/example/EuclideanGraphExample.java --- @@ -0,0 +1,231 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.flink.graph.example; + +import org.apache.flink.api.common.ProgramDescription; +import org.apache.flink.api.common.functions.MapFunction; +import org.apache.flink.api.java.DataSet; +import org.apache.flink.api.java.ExecutionEnvironment; +import org.apache.flink.api.java.tuple.Tuple3; +import org.apache.flink.graph.Edge; +import org.apache.flink.graph.Graph; +import org.apache.flink.graph.Triplet; +import org.apache.flink.graph.Vertex; +import org.apache.flink.graph.example.utils.EuclideanGraphData; + +import java.io.Serializable; + +/** + * Given a directed, unweighted graph, with vertex values representing points in a plan, + * return a weighted graph where the edge weights are equal to the Euclidean distance between the + * src and the trg vertex values. + * + * + * Input files are plain text files and must be formatted as follows: + * + * Vertices are represented by their vertexIds and vertex values and are separated by newlines, + * the value being formed of two doubles separated by a comma. + * For example: 1,1.0,1.0\n2,2.0,2.0\n3,3.0,3.0\n defines a data set of three vertices + * Edges are represented by triples of srcVertexId, srcEdgeId, weight which are + * separated by commas. Edges themselves are separated by newlines. The initial edge value will be overwritten. + * For example: 1,2,13.0\n1,3,6.0\n defines two edges 1-2 and 1-3 having + * weights 13 and 6 respectively. + * + * + * + * Usage EuclideanDistanceExample+ * If no parameters are provided, the program is ran with default data from + * {@link org.apache.flink.graph.example.utils.EuclideanGraphData} + */ +@SuppressWarnings("serial") +public class EuclideanGraphExample implements ProgramDescription { + + public static void main(String[] args) throws Exception { + + if (!parseParameters(args)) { + return; + } + + ExecutionEnvironment env = ExecutionEnvironment.getExecutionEnvironment(); + + DataSet> vertices = getVerticesDataSet(env); + + DataSet> edges = getEdgesDataSet(env); + + Graph graph = Graph.fromDataSet(vertices, edges, env); + + DataSet> triplets = graph.getTriplets(); + + // the edge value will be the Euclidean distance between its src and trg vertex + DataSet> resultedTriplets = triplets + .map(new MapFunction, Triplet>() { + + @Override + public Triplet map(Triplet triplet) throws Exception { + + Vertex srcVertex = triplet.getSrcVertex(); + Vertex trgVertex = triplet.getTrgVertex(); + Edge edge = triplet.getEdge(); + + edge.setValue(srcVertex.getValue().euclideanDistance(trgVertex.getValue())); + + return new Triplet(srcVertex, trgVertex, edge); + } + }); + + // retrieve the edges from the final result + DataSet> result = resultedTriplets + .map(new MapFunction, Edge>() { + + @Override + public Edge map(Triplet triplet) throws Exception { +
[GitHub] flink pull request: [FLINK-1633][gelly] Added getTriplets() method...
Github user vasia commented on a diff in the pull request: https://github.com/apache/flink/pull/452#discussion_r26487919 --- Diff: flink-staging/flink-gelly/src/main/java/org/apache/flink/graph/example/EuclideanGraphExample.java --- @@ -0,0 +1,231 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.flink.graph.example; + +import org.apache.flink.api.common.ProgramDescription; +import org.apache.flink.api.common.functions.MapFunction; +import org.apache.flink.api.java.DataSet; +import org.apache.flink.api.java.ExecutionEnvironment; +import org.apache.flink.api.java.tuple.Tuple3; +import org.apache.flink.graph.Edge; +import org.apache.flink.graph.Graph; +import org.apache.flink.graph.Triplet; +import org.apache.flink.graph.Vertex; +import org.apache.flink.graph.example.utils.EuclideanGraphData; + +import java.io.Serializable; + +/** + * Given a directed, unweighted graph, with vertex values representing points in a plan, + * return a weighted graph where the edge weights are equal to the Euclidean distance between the + * src and the trg vertex values. + * + * + * Input files are plain text files and must be formatted as follows: + * + * Vertices are represented by their vertexIds and vertex values and are separated by newlines, + * the value being formed of two doubles separated by a comma. + * For example: 1,1.0,1.0\n2,2.0,2.0\n3,3.0,3.0\n defines a data set of three vertices + * Edges are represented by triples of srcVertexId, srcEdgeId, weight which are + * separated by commas. Edges themselves are separated by newlines. The initial edge value will be overwritten. + * For example: 1,2,13.0\n1,3,6.0\n defines two edges 1-2 and 1-3 having + * weights 13 and 6 respectively. + * + * + * + * Usage EuclideanDistanceExample+ * If no parameters are provided, the program is ran with default data from + * {@link org.apache.flink.graph.example.utils.EuclideanGraphData} + */ +@SuppressWarnings("serial") +public class EuclideanGraphExample implements ProgramDescription { + + public static void main(String[] args) throws Exception { + + if (!parseParameters(args)) { + return; + } + + ExecutionEnvironment env = ExecutionEnvironment.getExecutionEnvironment(); + + DataSet> vertices = getVerticesDataSet(env); + + DataSet> edges = getEdgesDataSet(env); + + Graph graph = Graph.fromDataSet(vertices, edges, env); + + DataSet> triplets = graph.getTriplets(); + + // the edge value will be the Euclidean distance between its src and trg vertex + DataSet> resultedTriplets = triplets + .map(new MapFunction, Triplet>() { + + @Override + public Triplet map(Triplet triplet) throws Exception { + + Vertex srcVertex = triplet.getSrcVertex(); + Vertex trgVertex = triplet.getTrgVertex(); + Edge edge = triplet.getEdge(); + + edge.setValue(srcVertex.getValue().euclideanDistance(trgVertex.getValue())); + + return new Triplet(srcVertex, trgVertex, edge); + } + }); + + // retrieve the edges from the final result + DataSet> result = resultedTriplets + .map(new MapFunction, Edge>() { + + @Override + public Edge map(Triplet triplet) throws Exception { +
[GitHub] flink pull request: [FLINK-1633][gelly] Added getTriplets() method...
Github user vasia commented on a diff in the pull request: https://github.com/apache/flink/pull/452#discussion_r26488028 --- Diff: flink-staging/flink-gelly/src/main/java/org/apache/flink/graph/example/EuclideanGraphExample.java --- @@ -0,0 +1,231 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.flink.graph.example; + +import org.apache.flink.api.common.ProgramDescription; +import org.apache.flink.api.common.functions.MapFunction; +import org.apache.flink.api.java.DataSet; +import org.apache.flink.api.java.ExecutionEnvironment; +import org.apache.flink.api.java.tuple.Tuple3; +import org.apache.flink.graph.Edge; +import org.apache.flink.graph.Graph; +import org.apache.flink.graph.Triplet; +import org.apache.flink.graph.Vertex; +import org.apache.flink.graph.example.utils.EuclideanGraphData; + +import java.io.Serializable; + +/** + * Given a directed, unweighted graph, with vertex values representing points in a plan, + * return a weighted graph where the edge weights are equal to the Euclidean distance between the + * src and the trg vertex values. + * + * + * Input files are plain text files and must be formatted as follows: + * + * Vertices are represented by their vertexIds and vertex values and are separated by newlines, + * the value being formed of two doubles separated by a comma. + * For example: 1,1.0,1.0\n2,2.0,2.0\n3,3.0,3.0\n defines a data set of three vertices + * Edges are represented by triples of srcVertexId, srcEdgeId, weight which are + * separated by commas. Edges themselves are separated by newlines. The initial edge value will be overwritten. + * For example: 1,2,13.0\n1,3,6.0\n defines two edges 1-2 and 1-3 having + * weights 13 and 6 respectively. + * + * + * + * Usage EuclideanDistanceExample+ * If no parameters are provided, the program is ran with default data from --- End diff -- In "is run", run is a participle, while "ran" is past tense. I'm not native English speaker, but I think "is ran" is wrong :)) --- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. ---
[GitHub] flink pull request: [FLINK-1633][gelly] Added getTriplets() method...
Github user vasia commented on a diff in the pull request: https://github.com/apache/flink/pull/452#discussion_r26487206 --- Diff: flink-staging/flink-gelly/src/main/java/org/apache/flink/graph/example/EuclideanGraphExample.java --- @@ -0,0 +1,231 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.flink.graph.example; + +import org.apache.flink.api.common.ProgramDescription; +import org.apache.flink.api.common.functions.MapFunction; +import org.apache.flink.api.java.DataSet; +import org.apache.flink.api.java.ExecutionEnvironment; +import org.apache.flink.api.java.tuple.Tuple3; +import org.apache.flink.graph.Edge; +import org.apache.flink.graph.Graph; +import org.apache.flink.graph.Triplet; +import org.apache.flink.graph.Vertex; +import org.apache.flink.graph.example.utils.EuclideanGraphData; + +import java.io.Serializable; + +/** + * Given a directed, unweighted graph, with vertex values representing points in a plan, + * return a weighted graph where the edge weights are equal to the Euclidean distance between the + * src and the trg vertex values. + * + * + * Input files are plain text files and must be formatted as follows: + * + * Vertices are represented by their vertexIds and vertex values and are separated by newlines, + * the value being formed of two doubles separated by a comma. + * For example: 1,1.0,1.0\n2,2.0,2.0\n3,3.0,3.0\n defines a data set of three vertices + * Edges are represented by triples of srcVertexId, srcEdgeId, weight which are + * separated by commas. Edges themselves are separated by newlines. The initial edge value will be overwritten. + * For example: 1,2,13.0\n1,3,6.0\n defines two edges 1-2 and 1-3 having + * weights 13 and 6 respectively. + * + * + * + * Usage EuclideanDistanceExample+ * If no parameters are provided, the program is ran with default data from + * {@link org.apache.flink.graph.example.utils.EuclideanGraphData} + */ +@SuppressWarnings("serial") +public class EuclideanGraphExample implements ProgramDescription { + + public static void main(String[] args) throws Exception { + + if (!parseParameters(args)) { + return; + } + + ExecutionEnvironment env = ExecutionEnvironment.getExecutionEnvironment(); + + DataSet> vertices = getVerticesDataSet(env); + + DataSet> edges = getEdgesDataSet(env); + + Graph graph = Graph.fromDataSet(vertices, edges, env); + + DataSet> triplets = graph.getTriplets(); + + // the edge value will be the Euclidean distance between its src and trg vertex + DataSet> resultedTriplets = triplets + .map(new MapFunction, Triplet>() { + + @Override + public Triplet map(Triplet triplet) throws Exception { + + Vertex srcVertex = triplet.getSrcVertex(); + Vertex trgVertex = triplet.getTrgVertex(); + Edge edge = triplet.getEdge(); + + edge.setValue(srcVertex.getValue().euclideanDistance(trgVertex.getValue())); + + return new Triplet(srcVertex, trgVertex, edge); + } + }); + + // retrieve the edges from the final result + DataSet> result = resultedTriplets + .map(new MapFunction, Edge>() { + + @Override + public Edge map(Triplet triplet) throws Exception { +
[GitHub] flink pull request: [FLINK-1633][gelly] Added getTriplets() method...
Github user vasia commented on a diff in the pull request: https://github.com/apache/flink/pull/452#discussion_r26487008 --- Diff: flink-staging/flink-gelly/src/main/java/org/apache/flink/graph/example/EuclideanGraphExample.java --- @@ -0,0 +1,231 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.flink.graph.example; + +import org.apache.flink.api.common.ProgramDescription; +import org.apache.flink.api.common.functions.MapFunction; +import org.apache.flink.api.java.DataSet; +import org.apache.flink.api.java.ExecutionEnvironment; +import org.apache.flink.api.java.tuple.Tuple3; +import org.apache.flink.graph.Edge; +import org.apache.flink.graph.Graph; +import org.apache.flink.graph.Triplet; +import org.apache.flink.graph.Vertex; +import org.apache.flink.graph.example.utils.EuclideanGraphData; + +import java.io.Serializable; + +/** + * Given a directed, unweighted graph, with vertex values representing points in a plan, + * return a weighted graph where the edge weights are equal to the Euclidean distance between the + * src and the trg vertex values. + * + * + * Input files are plain text files and must be formatted as follows: + * + * Vertices are represented by their vertexIds and vertex values and are separated by newlines, + * the value being formed of two doubles separated by a comma. + * For example: 1,1.0,1.0\n2,2.0,2.0\n3,3.0,3.0\n defines a data set of three vertices + * Edges are represented by triples of srcVertexId, srcEdgeId, weight which are + * separated by commas. Edges themselves are separated by newlines. The initial edge value will be overwritten. + * For example: 1,2,13.0\n1,3,6.0\n defines two edges 1-2 and 1-3 having + * weights 13 and 6 respectively. + * + * + * + * Usage EuclideanDistanceExample+ * If no parameters are provided, the program is ran with default data from + * {@link org.apache.flink.graph.example.utils.EuclideanGraphData} + */ +@SuppressWarnings("serial") +public class EuclideanGraphExample implements ProgramDescription { + + public static void main(String[] args) throws Exception { + + if (!parseParameters(args)) { + return; + } + + ExecutionEnvironment env = ExecutionEnvironment.getExecutionEnvironment(); + + DataSet> vertices = getVerticesDataSet(env); + + DataSet> edges = getEdgesDataSet(env); + + Graph graph = Graph.fromDataSet(vertices, edges, env); + + DataSet> triplets = graph.getTriplets(); + + // the edge value will be the Euclidean distance between its src and trg vertex + DataSet> resultedTriplets = triplets --- End diff -- Why return a DataSet of Triplets here? wouldn't it be nicer to return a DataSet Tuple3s (srcID, trgID, value) and then use joinWithEdges to directly get the weighted graph? --- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. ---
[GitHub] flink pull request: [FLINK-1633][gelly] Added getTriplets() method...
Github user vasia commented on a diff in the pull request: https://github.com/apache/flink/pull/452#discussion_r26487167 --- Diff: flink-staging/flink-gelly/src/main/java/org/apache/flink/graph/example/EuclideanGraphExample.java --- @@ -0,0 +1,231 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.flink.graph.example; + +import org.apache.flink.api.common.ProgramDescription; +import org.apache.flink.api.common.functions.MapFunction; +import org.apache.flink.api.java.DataSet; +import org.apache.flink.api.java.ExecutionEnvironment; +import org.apache.flink.api.java.tuple.Tuple3; +import org.apache.flink.graph.Edge; +import org.apache.flink.graph.Graph; +import org.apache.flink.graph.Triplet; +import org.apache.flink.graph.Vertex; +import org.apache.flink.graph.example.utils.EuclideanGraphData; + +import java.io.Serializable; + +/** + * Given a directed, unweighted graph, with vertex values representing points in a plan, + * return a weighted graph where the edge weights are equal to the Euclidean distance between the + * src and the trg vertex values. + * + * + * Input files are plain text files and must be formatted as follows: + * + * Vertices are represented by their vertexIds and vertex values and are separated by newlines, + * the value being formed of two doubles separated by a comma. + * For example: 1,1.0,1.0\n2,2.0,2.0\n3,3.0,3.0\n defines a data set of three vertices + * Edges are represented by triples of srcVertexId, srcEdgeId, weight which are + * separated by commas. Edges themselves are separated by newlines. The initial edge value will be overwritten. + * For example: 1,2,13.0\n1,3,6.0\n defines two edges 1-2 and 1-3 having + * weights 13 and 6 respectively. + * + * + * + * Usage EuclideanDistanceExample+ * If no parameters are provided, the program is ran with default data from + * {@link org.apache.flink.graph.example.utils.EuclideanGraphData} + */ +@SuppressWarnings("serial") +public class EuclideanGraphExample implements ProgramDescription { + + public static void main(String[] args) throws Exception { + + if (!parseParameters(args)) { + return; + } + + ExecutionEnvironment env = ExecutionEnvironment.getExecutionEnvironment(); + + DataSet> vertices = getVerticesDataSet(env); + + DataSet> edges = getEdgesDataSet(env); + + Graph graph = Graph.fromDataSet(vertices, edges, env); + + DataSet> triplets = graph.getTriplets(); + + // the edge value will be the Euclidean distance between its src and trg vertex + DataSet> resultedTriplets = triplets + .map(new MapFunction, Triplet>() { + + @Override + public Triplet map(Triplet triplet) throws Exception { + + Vertex srcVertex = triplet.getSrcVertex(); + Vertex trgVertex = triplet.getTrgVertex(); + Edge edge = triplet.getEdge(); + + edge.setValue(srcVertex.getValue().euclideanDistance(trgVertex.getValue())); + + return new Triplet(srcVertex, trgVertex, edge); + } + }); + + // retrieve the edges from the final result + DataSet> result = resultedTriplets + .map(new MapFunction, Edge>() { + + @Override + public Edge map(Triplet triplet) throws Exception { +
[GitHub] flink pull request: [FLINK-1633][gelly] Added getTriplets() method...
Github user vasia commented on a diff in the pull request: https://github.com/apache/flink/pull/452#discussion_r26487229 --- Diff: flink-staging/flink-gelly/src/main/java/org/apache/flink/graph/example/EuclideanGraphExample.java --- @@ -0,0 +1,231 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.flink.graph.example; + +import org.apache.flink.api.common.ProgramDescription; +import org.apache.flink.api.common.functions.MapFunction; +import org.apache.flink.api.java.DataSet; +import org.apache.flink.api.java.ExecutionEnvironment; +import org.apache.flink.api.java.tuple.Tuple3; +import org.apache.flink.graph.Edge; +import org.apache.flink.graph.Graph; +import org.apache.flink.graph.Triplet; +import org.apache.flink.graph.Vertex; +import org.apache.flink.graph.example.utils.EuclideanGraphData; + +import java.io.Serializable; + +/** + * Given a directed, unweighted graph, with vertex values representing points in a plan, + * return a weighted graph where the edge weights are equal to the Euclidean distance between the + * src and the trg vertex values. + * + * + * Input files are plain text files and must be formatted as follows: + * + * Vertices are represented by their vertexIds and vertex values and are separated by newlines, + * the value being formed of two doubles separated by a comma. + * For example: 1,1.0,1.0\n2,2.0,2.0\n3,3.0,3.0\n defines a data set of three vertices + * Edges are represented by triples of srcVertexId, srcEdgeId, weight which are + * separated by commas. Edges themselves are separated by newlines. The initial edge value will be overwritten. + * For example: 1,2,13.0\n1,3,6.0\n defines two edges 1-2 and 1-3 having + * weights 13 and 6 respectively. + * + * + * + * Usage EuclideanDistanceExample+ * If no parameters are provided, the program is ran with default data from + * {@link org.apache.flink.graph.example.utils.EuclideanGraphData} + */ +@SuppressWarnings("serial") +public class EuclideanGraphExample implements ProgramDescription { + + public static void main(String[] args) throws Exception { + + if (!parseParameters(args)) { + return; + } + + ExecutionEnvironment env = ExecutionEnvironment.getExecutionEnvironment(); + + DataSet> vertices = getVerticesDataSet(env); + + DataSet> edges = getEdgesDataSet(env); + + Graph graph = Graph.fromDataSet(vertices, edges, env); + + DataSet> triplets = graph.getTriplets(); + + // the edge value will be the Euclidean distance between its src and trg vertex + DataSet> resultedTriplets = triplets + .map(new MapFunction, Triplet>() { + + @Override + public Triplet map(Triplet triplet) throws Exception { + + Vertex srcVertex = triplet.getSrcVertex(); + Vertex trgVertex = triplet.getTrgVertex(); + Edge edge = triplet.getEdge(); + + edge.setValue(srcVertex.getValue().euclideanDistance(trgVertex.getValue())); + + return new Triplet(srcVertex, trgVertex, edge); + } + }); + + // retrieve the edges from the final result + DataSet> result = resultedTriplets + .map(new MapFunction, Edge>() { + + @Override + public Edge map(Triplet triplet) throws Exception { +
[GitHub] flink pull request: [FLINK-1633][gelly] Added getTriplets() method...
Github user andralungu commented on a diff in the pull request: https://github.com/apache/flink/pull/452#discussion_r26487168 --- Diff: flink-staging/flink-gelly/src/main/java/org/apache/flink/graph/example/EuclideanGraphExample.java --- @@ -0,0 +1,231 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.flink.graph.example; + +import org.apache.flink.api.common.ProgramDescription; +import org.apache.flink.api.common.functions.MapFunction; +import org.apache.flink.api.java.DataSet; +import org.apache.flink.api.java.ExecutionEnvironment; +import org.apache.flink.api.java.tuple.Tuple3; +import org.apache.flink.graph.Edge; +import org.apache.flink.graph.Graph; +import org.apache.flink.graph.Triplet; +import org.apache.flink.graph.Vertex; +import org.apache.flink.graph.example.utils.EuclideanGraphData; + +import java.io.Serializable; + +/** + * Given a directed, unweighted graph, with vertex values representing points in a plan, + * return a weighted graph where the edge weights are equal to the Euclidean distance between the + * src and the trg vertex values. + * + * + * Input files are plain text files and must be formatted as follows: + * + * Vertices are represented by their vertexIds and vertex values and are separated by newlines, + * the value being formed of two doubles separated by a comma. + * For example: 1,1.0,1.0\n2,2.0,2.0\n3,3.0,3.0\n defines a data set of three vertices + * Edges are represented by triples of srcVertexId, srcEdgeId, weight which are + * separated by commas. Edges themselves are separated by newlines. The initial edge value will be overwritten. + * For example: 1,2,13.0\n1,3,6.0\n defines two edges 1-2 and 1-3 having + * weights 13 and 6 respectively. + * + * + * + * Usage EuclideanDistanceExample+ * If no parameters are provided, the program is ran with default data from --- End diff -- I know that's how it's written in the other examples, but according to my English, it's "is ran". It's either "If no parameters are provided, run the program..." or "the program is ran with default data" But I can change it if it's a problem... --- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. ---
[GitHub] flink pull request: [FLINK-1633][gelly] Added getTriplets() method...
Github user andralungu commented on a diff in the pull request: https://github.com/apache/flink/pull/452#discussion_r26487028 --- Diff: flink-staging/flink-gelly/src/main/java/org/apache/flink/graph/example/EuclideanGraphExample.java --- @@ -0,0 +1,231 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.flink.graph.example; + +import org.apache.flink.api.common.ProgramDescription; +import org.apache.flink.api.common.functions.MapFunction; +import org.apache.flink.api.java.DataSet; +import org.apache.flink.api.java.ExecutionEnvironment; +import org.apache.flink.api.java.tuple.Tuple3; +import org.apache.flink.graph.Edge; +import org.apache.flink.graph.Graph; +import org.apache.flink.graph.Triplet; +import org.apache.flink.graph.Vertex; +import org.apache.flink.graph.example.utils.EuclideanGraphData; + +import java.io.Serializable; + +/** + * Given a directed, unweighted graph, with vertex values representing points in a plan, + * return a weighted graph where the edge weights are equal to the Euclidean distance between the + * src and the trg vertex values. + * + * + * Input files are plain text files and must be formatted as follows: + * + * Vertices are represented by their vertexIds and vertex values and are separated by newlines, + * the value being formed of two doubles separated by a comma. + * For example: 1,1.0,1.0\n2,2.0,2.0\n3,3.0,3.0\n defines a data set of three vertices + * Edges are represented by triples of srcVertexId, srcEdgeId, weight which are + * separated by commas. Edges themselves are separated by newlines. The initial edge value will be overwritten. + * For example: 1,2,13.0\n1,3,6.0\n defines two edges 1-2 and 1-3 having + * weights 13 and 6 respectively. + * + * + * + * Usage EuclideanDistanceExample--- End diff -- oops! yes it's Graph. Will fix! --- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. ---
[GitHub] flink pull request: [FLINK-1633][gelly] Added getTriplets() method...
Github user vasia commented on a diff in the pull request: https://github.com/apache/flink/pull/452#discussion_r26486381 --- Diff: flink-staging/flink-gelly/src/main/java/org/apache/flink/graph/example/EuclideanGraphExample.java --- @@ -0,0 +1,231 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.flink.graph.example; + +import org.apache.flink.api.common.ProgramDescription; +import org.apache.flink.api.common.functions.MapFunction; +import org.apache.flink.api.java.DataSet; +import org.apache.flink.api.java.ExecutionEnvironment; +import org.apache.flink.api.java.tuple.Tuple3; +import org.apache.flink.graph.Edge; +import org.apache.flink.graph.Graph; +import org.apache.flink.graph.Triplet; +import org.apache.flink.graph.Vertex; +import org.apache.flink.graph.example.utils.EuclideanGraphData; + +import java.io.Serializable; + +/** + * Given a directed, unweighted graph, with vertex values representing points in a plan, + * return a weighted graph where the edge weights are equal to the Euclidean distance between the + * src and the trg vertex values. + * + * + * Input files are plain text files and must be formatted as follows: + * + * Vertices are represented by their vertexIds and vertex values and are separated by newlines, + * the value being formed of two doubles separated by a comma. + * For example: 1,1.0,1.0\n2,2.0,2.0\n3,3.0,3.0\n defines a data set of three vertices + * Edges are represented by triples of srcVertexId, srcEdgeId, weight which are + * separated by commas. Edges themselves are separated by newlines. The initial edge value will be overwritten. + * For example: 1,2,13.0\n1,3,6.0\n defines two edges 1-2 and 1-3 having + * weights 13 and 6 respectively. + * + * + * + * Usage EuclideanDistanceExample+ * If no parameters are provided, the program is ran with default data from --- End diff -- *is run --- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. ---
[GitHub] flink pull request: [FLINK-1633][gelly] Added getTriplets() method...
Github user vasia commented on a diff in the pull request: https://github.com/apache/flink/pull/452#discussion_r26486364 --- Diff: flink-staging/flink-gelly/src/main/java/org/apache/flink/graph/example/EuclideanGraphExample.java --- @@ -0,0 +1,231 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.flink.graph.example; + +import org.apache.flink.api.common.ProgramDescription; +import org.apache.flink.api.common.functions.MapFunction; +import org.apache.flink.api.java.DataSet; +import org.apache.flink.api.java.ExecutionEnvironment; +import org.apache.flink.api.java.tuple.Tuple3; +import org.apache.flink.graph.Edge; +import org.apache.flink.graph.Graph; +import org.apache.flink.graph.Triplet; +import org.apache.flink.graph.Vertex; +import org.apache.flink.graph.example.utils.EuclideanGraphData; + +import java.io.Serializable; + +/** + * Given a directed, unweighted graph, with vertex values representing points in a plan, + * return a weighted graph where the edge weights are equal to the Euclidean distance between the + * src and the trg vertex values. + * + * + * Input files are plain text files and must be formatted as follows: + * + * Vertices are represented by their vertexIds and vertex values and are separated by newlines, + * the value being formed of two doubles separated by a comma. + * For example: 1,1.0,1.0\n2,2.0,2.0\n3,3.0,3.0\n defines a data set of three vertices + * Edges are represented by triples of srcVertexId, srcEdgeId, weight which are + * separated by commas. Edges themselves are separated by newlines. The initial edge value will be overwritten. + * For example: 1,2,13.0\n1,3,6.0\n defines two edges 1-2 and 1-3 having + * weights 13 and 6 respectively. + * + * + * + * Usage EuclideanDistanceExample--- End diff -- EuclideanGraph? --- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. ---
[GitHub] flink pull request: [FLINK-1633][gelly] Added getTriplets() method...
Github user andralungu commented on the pull request: https://github.com/apache/flink/pull/452#issuecomment-80369017 @vasia , The tests on the cluster were also successful. Good to go from my side. --- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. ---
[GitHub] flink pull request: [FLINK-1633][gelly] Added getTriplets() method...
Github user vasia commented on the pull request: https://github.com/apache/flink/pull/452#issuecomment-78461681 Thanks for implementing this @andralungu! I have added some inline comments. Also, we are definitely missing documentation and an example using the method. I would suggest something simple, like weighting an input graph, by computing the euclidean distance of the src/vertex values for each edge and attaching this value as the edge weight. What do you think? --- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. ---
[GitHub] flink pull request: [FLINK-1633][gelly] Added getTriplets() method...
Github user vasia commented on a diff in the pull request: https://github.com/apache/flink/pull/452#discussion_r26293336 --- Diff: flink-staging/flink-gelly/src/main/java/org/apache/flink/graph/utils/Triplet.java --- @@ -0,0 +1,55 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.flink.graph.utils; --- End diff -- I would put this in `org.apache.flink.graph` instead. --- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. ---
[GitHub] flink pull request: [FLINK-1633][gelly] Added getTriplets() method...
Github user vasia commented on a diff in the pull request: https://github.com/apache/flink/pull/452#discussion_r26293223 --- Diff: flink-staging/flink-gelly/src/main/java/org/apache/flink/graph/utils/Triplet.java --- @@ -0,0 +1,55 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.flink.graph.utils; + +import org.apache.flink.api.java.tuple.Tuple5; +import org.apache.flink.graph.Edge; +import org.apache.flink.graph.Vertex; + +import java.io.Serializable; + +/** + * A wrapper around Tuple5 used to avoid duplicate vertex ids and to improve readability in + * the {@link org.apache.flink.graph.Graph#getTriplets()} method. + * + * @param the vertex key type + * @param the vertex value type + * @param the edge value type + */ +public class Triplet & Serializable, VV extends Serializable, EV extends Serializable> + extends Tuple5 { + + public Triplet() {} + + public Triplet(K srcId, K trgId, VV srcVal, VV trgVal, EV edgeVal) { + super(srcId, trgId, srcVal, trgVal, edgeVal); --- End diff -- Wouldn't a constructor be more useful/intuitive for a user? We can keep this one too, but better add a javadoc :-) --- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. ---
[GitHub] flink pull request: [FLINK-1633][gelly] Added getTriplets() method...
Github user vasia commented on a diff in the pull request: https://github.com/apache/flink/pull/452#discussion_r26293166 --- Diff: flink-staging/flink-gelly/src/main/java/org/apache/flink/graph/utils/Triplet.java --- @@ -0,0 +1,55 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.flink.graph.utils; + +import org.apache.flink.api.java.tuple.Tuple5; +import org.apache.flink.graph.Edge; +import org.apache.flink.graph.Vertex; + +import java.io.Serializable; + +/** + * A wrapper around Tuple5 used to avoid duplicate vertex ids and to improve readability in --- End diff -- I would prefer a description about what a Triplet is conceptually and how it can be used by user here, instead of explaining that it wraps a Tuple5 :)) --- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. ---
[GitHub] flink pull request: [FLINK-1633][gelly] Added getTriplets() method...
Github user vasia commented on a diff in the pull request: https://github.com/apache/flink/pull/452#discussion_r26293025 --- Diff: flink-staging/flink-gelly/src/main/java/org/apache/flink/graph/Graph.java --- @@ -326,6 +328,34 @@ public ExecutionEnvironment getContext() { } --- End diff -- some description of what this method does would be nice :-) --- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. ---
[GitHub] flink pull request: [FLINK-1633][gelly] Added getTriplets() method...
Github user vasia commented on a diff in the pull request: https://github.com/apache/flink/pull/452#discussion_r26292951 --- Diff: flink-staging/flink-gelly/src/main/java/org/apache/flink/graph/Graph.java --- @@ -326,6 +328,34 @@ public ExecutionEnvironment getContext() { } /** +* @return a triplet DataSet consisting of (srcVertexId, trgVertexId, srcVertexValue, trgVertexValue, edgeValue) +*/ + public DataSet> getTriplets() { + return this.getVertices().join(this.getEdges()).where(0).equalTo(0) + .with(new FlatJoinFunction, Edge, Tuple4>() { + + @Override + public void join(Vertex vertex, Edge edge, Collector> collector) + throws Exception { --- End diff -- We should run some experiments and check whether this creates a deadlock. It's the same join pattern that created problems with #408. --- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. ---
[GitHub] flink pull request: [FLINK-1633][gelly] Added getTriplets() method...
GitHub user andralungu opened a pull request: https://github.com/apache/flink/pull/452 [FLINK-1633][gelly] Added getTriplets() method and test A convenience Gelly method that generates a DataSet of from the input graph. You can merge this pull request into a Git repository by running: $ git pull https://github.com/andralungu/flink triplets Alternatively you can review and apply these changes as the patch at: https://github.com/apache/flink/pull/452.patch To close this pull request, make a commit to your master/trunk branch with (at least) the following in the commit message: This closes #452 commit a14d27586783e9fce6996851b45f30fcbd9e4782 Author: andralungu Date: 2015-03-03T22:03:43Z [FLINK-1633][gelly] Added getTriplets() method and test --- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. ---