Github user rmetzger commented on a diff in the pull request:
https://github.com/apache/flink/pull/414#discussion_r24829996
--- Diff:
flink-staging/flink-gelly/src/main/java/org/apache/flink/graph/example/SingleSourceShortestPathsExample.java
---
@@ -56,4 +63,77 @@ public static void main(String[] args) throws Exception {
public String getDescription() {
return "Single Source Shortest Paths";
}
+
+ //
******************************************************************************************************************
+ // UTIL METHODS
+ //
******************************************************************************************************************
+
+ private static boolean fileOutput = false;
+
+ private static Long srcVertexId = null;
+
+ private static String verticesInputPath = null;
+
+ private static String edgesInputPath = null;
+
+ private static String outputPath = null;
+
+ private static int maxIterations = 5;
+
+ private static boolean parseParameters(String[] args) {
+
+ if (args.length > 0) {
+ if (args.length == 5) {
+ fileOutput = true;
+ srcVertexId = Long.parseLong(args[0]);
+ verticesInputPath = args[1];
+ edgesInputPath = args[2];
+ outputPath = args[3];
+ maxIterations = Integer.parseInt(args[4]);
+ } else {
+ System.err.println("Usage:
SingleSourceShortestPaths <source vertex id>" +
+ " <input vertices path> <input
edges path> <output path> <num iterations>");
+ return false;
+ }
+ }
+ return true;
+ }
+
+ private static DataSet<Vertex<Long, Double>>
getVerticesDataSet(ExecutionEnvironment env) {
+ if (fileOutput) {
+ return env.readCsvFile(verticesInputPath)
+ .lineDelimiter("\n")
+ .types(Long.class, Double.class)
+ .map(new MapFunction<Tuple2<Long,
Double>, Vertex<Long, Double>>() {
+
+ @Override
+ public Vertex<Long, Double>
map(Tuple2<Long, Double> tuple2) throws Exception {
+ return new Vertex<Long,
Double>(tuple2.f0, tuple2.f1);
+ }
+ });
+ } else {
+ System.err.println("Usage: SingleSourceShortestPaths
<source vertex id>" +
+ " <input vertices path> <input edges
path> <output path> <num iterations>");
+ return null;
--- End diff --
I suspect the code will fail with a null pointer exception?
---
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 [email protected] or file a JIRA ticket
with INFRA.
---