private static DataSet<Long> getVertexDataSet(ExecutionEnvironment env) { if(fileOutput) { return env.readCsvFile(verticesPath).types(Long.class) .map( new MapFunction<Tuple1<Long>, Long>() { public Long map(Tuple1<Long> value) { return value.f0; } }); } else { return ConnectedComponentsData.getDefaultVertexDataSet(env); } }
private static DataSet<Long> getVertexDataSet(ExecutionEnvironment env) { if(fileOutput) { return env.readCsvFile(verticesPath).types(Long.class) .map( new MapFunction<Tuple1<Long>, Long>() { public Long map(Tuple1<Long> value) { return value.f0; } }); } else { return ConnectedComponentsData.getDefaultVertexDataSet(env); } }
private static DataSet<Edge> getEdgeDataSet(ExecutionEnvironment env) { if(fileOutput) { return env.readCsvFile(edgePath) .fieldDelimiter(' ') .includeFields(true, true) .types(Integer.class, Integer.class) .map(new TupleEdgeConverter()); } else { return EnumTrianglesData.getDefaultEdgeDataSet(env); } }
private static DataSet<Point> getPointDataSet(ExecutionEnvironment env) { if(fileOutput) { // read points from CSV file return env.readCsvFile(pointsPath) .fieldDelimiter(' ') .includeFields(true, true) .types(Double.class, Double.class) .map(new TuplePointConverter()); } else { return KMeansData.getDefaultPointDataSet(env); } }
private static DataSet<Edge> getEdgeDataSet(ExecutionEnvironment env) { if(fileOutput) { return env.readCsvFile(edgePath) .fieldDelimiter(' ') .includeFields(true, true) .types(Integer.class, Integer.class) .map(new TupleEdgeConverter()); } else { return EnumTrianglesData.getDefaultEdgeDataSet(env); } }
private static DataSet<Edge> getEdgeDataSet(ExecutionEnvironment env) { if(fileOutput) { return env.readCsvFile(edgePath) .fieldDelimiter(' ') .includeFields(true, true) .types(Integer.class, Integer.class) .map(new TupleEdgeConverter()); } else { return EnumTrianglesData.getDefaultEdgeDataSet(env); } }
private static DataSet<Point> getPointDataSet(ExecutionEnvironment env) { if(fileOutput) { // read points from CSV file return env.readCsvFile(pointsPath) .fieldDelimiter(' ') .includeFields(true, true) .types(Double.class, Double.class) .map(new TuplePointConverter()); } else { return KMeansData.getDefaultPointDataSet(env); } }
private static DataSet<Centroid> getCentroidDataSet(ExecutionEnvironment env) { if(fileOutput) { return env.readCsvFile(centersPath) .fieldDelimiter(' ') .includeFields(true, true, true) .types(Integer.class, Double.class, Double.class) .map(new TupleCentroidConverter()); } else { return KMeansData.getDefaultCentroidDataSet(env); } }
private static DataSet<Edge> getEdgeDataSet(ExecutionEnvironment env) { if(fileOutput) { return env.readCsvFile(edgePath) .fieldDelimiter(' ') .includeFields(true, true) .types(Integer.class, Integer.class) .map(new TupleEdgeConverter()); } else { return EnumTrianglesData.getDefaultEdgeDataSet(env); } }
private static DataSet<Centroid> getCentroidDataSet(ExecutionEnvironment env) { if(fileOutput) { return env.readCsvFile(centersPath) .fieldDelimiter(' ') .includeFields(true, true, true) .types(Integer.class, Double.class, Double.class) .map(new TupleCentroidConverter()); } else { return KMeansData.getDefaultCentroidDataSet(env); } }
private static DataSet<Point> getPointDataSet(ExecutionEnvironment env) { if(fileOutput) { // read points from CSV file return env.readCsvFile(pointsPath) .fieldDelimiter('|') .includeFields(true, true) .types(Double.class, Double.class) .map(new TuplePointConverter()); } else { throw new UnsupportedOperationException("Use file output"); } }
private static DataSet<Centroid> getCentroidDataSet(ExecutionEnvironment env) { if(fileOutput) { return env.readCsvFile(centersPath) .fieldDelimiter('|') .includeFields(true, true, true) .types(Integer.class, Double.class, Double.class) .map(new TupleCentroidConverter()); } else { throw new UnsupportedOperationException("Use file output"); } }
.map(new MapFunction<Long, Tuple2<Long, Double>>() { public Tuple2<Long, Double> map(Long value) { return new Tuple2<Long, Double>(value, 1.0/numVertices);