/** * Creates a graph from a CSV file of edges. Vertices will be created automatically. * * @param edgesPath a path to a CSV file with the Edges data * @param context the execution environment. * @return An instance of {@link org.apache.flink.graph.GraphCsvReader}, * on which calling methods to specify types of the Vertex ID, Vertex value and Edge value returns a Graph. * * @see org.apache.flink.graph.GraphCsvReader#types(Class, Class, Class) * @see org.apache.flink.graph.GraphCsvReader#vertexTypes(Class, Class) * @see org.apache.flink.graph.GraphCsvReader#edgeTypes(Class, Class) * @see org.apache.flink.graph.GraphCsvReader#keyType(Class) */ public static GraphCsvReader fromCsvReader(String edgesPath, ExecutionEnvironment context) { return new GraphCsvReader(edgesPath, context); }
@Override public Graph<K, NullValue, NullValue> create(ExecutionEnvironment env) throws Exception { GraphCsvReader reader = Graph.fromCsvReader(inputFilename.getValue(), env) .ignoreCommentsEdges(commentPrefix.getValue()) .lineDelimiterEdges(lineDelimiter.getValue()) .fieldDelimiterEdges(fieldDelimiter.getValue()); case INTEGER: graph = (Graph<K, NullValue, NullValue>) reader .keyType(IntValue.class); break; .keyType(LongValue.class); break; .keyType(StringValue.class); break;
private static Graph<Long, Double, Double> getGraph(ExecutionEnvironment env) { if (fileOutput) { return Graph.fromCsvReader(verticesInputPath, edgesInputPath, env).lineDelimiterEdges("\n") .types(Long.class, Double.class, Double.class); } else { return Graph.fromDataSet(IncrementalSSSPData.getDefaultVertexDataSet(env), IncrementalSSSPData.getDefaultEdgeDataSet(env), env); } }
/** * Creates a Graph from a CSV file of vertices and a CSV file of edges. * * @param verticesPath path to a CSV file with the Vertex data. * @param edgesPath path to a CSV file with the Edge data * @param context the Flink execution environment. * @return An instance of {@link org.apache.flink.graph.GraphCsvReader}, * on which calling methods to specify types of the Vertex ID, Vertex value and Edge value returns a Graph. * * @see org.apache.flink.graph.GraphCsvReader#types(Class, Class, Class) * @see org.apache.flink.graph.GraphCsvReader#vertexTypes(Class, Class) * @see org.apache.flink.graph.GraphCsvReader#edgeTypes(Class, Class) * @see org.apache.flink.graph.GraphCsvReader#keyType(Class) */ public static GraphCsvReader fromCsvReader(String verticesPath, String edgesPath, ExecutionEnvironment context) { return new GraphCsvReader(verticesPath, edgesPath, context); }
private static Graph<Long, Double, Double> getSSSPGraph(ExecutionEnvironment env) { if (fileOutput) { return Graph.fromCsvReader(verticesInputPath, edgesInSSSPInputPath, env).lineDelimiterEdges("\n") .types(Long.class, Double.class, Double.class); } else { return Graph.fromDataSet(IncrementalSSSPData.getDefaultVertexDataSet(env), IncrementalSSSPData.getDefaultEdgesInSSSP(env), env); } }
/** * Creates a graph from a CSV file of edges. Vertices will be created automatically and * Vertex values can be initialized using a user-defined mapper. * * @param edgesPath a path to a CSV file with the Edge data * @param vertexValueInitializer the mapper function that initializes the vertex values. * It allows to apply a map transformation on the vertex ID to produce an initial vertex value. * @param context the execution environment. * @return An instance of {@link org.apache.flink.graph.GraphCsvReader}, * on which calling methods to specify types of the Vertex ID, Vertex Value and Edge value returns a Graph. * * @see org.apache.flink.graph.GraphCsvReader#types(Class, Class, Class) * @see org.apache.flink.graph.GraphCsvReader#vertexTypes(Class, Class) * @see org.apache.flink.graph.GraphCsvReader#edgeTypes(Class, Class) * @see org.apache.flink.graph.GraphCsvReader#keyType(Class) */ public static <K, VV> GraphCsvReader fromCsvReader(String edgesPath, final MapFunction<K, VV> vertexValueInitializer, ExecutionEnvironment context) { return new GraphCsvReader(edgesPath, vertexValueInitializer, context); }
/** * Creates a graph from a CSV file of edges. Vertices will be created automatically. * * @param edgesPath a path to a CSV file with the Edges data * @param context the execution environment. * @return An instance of {@link org.apache.flink.graph.GraphCsvReader}, * on which calling methods to specify types of the Vertex ID, Vertex value and Edge value returns a Graph. * * @see org.apache.flink.graph.GraphCsvReader#types(Class, Class, Class) * @see org.apache.flink.graph.GraphCsvReader#vertexTypes(Class, Class) * @see org.apache.flink.graph.GraphCsvReader#edgeTypes(Class, Class) * @see org.apache.flink.graph.GraphCsvReader#keyType(Class) */ public static GraphCsvReader fromCsvReader(String edgesPath, ExecutionEnvironment context) { return new GraphCsvReader(edgesPath, context); }
/** * Creates a Graph from a CSV file of vertices and a CSV file of edges. * * @param verticesPath path to a CSV file with the Vertex data. * @param edgesPath path to a CSV file with the Edge data * @param context the Flink execution environment. * @return An instance of {@link org.apache.flink.graph.GraphCsvReader}, * on which calling methods to specify types of the Vertex ID, Vertex value and Edge value returns a Graph. * * @see org.apache.flink.graph.GraphCsvReader#types(Class, Class, Class) * @see org.apache.flink.graph.GraphCsvReader#vertexTypes(Class, Class) * @see org.apache.flink.graph.GraphCsvReader#edgeTypes(Class, Class) * @see org.apache.flink.graph.GraphCsvReader#keyType(Class) */ public static GraphCsvReader fromCsvReader(String verticesPath, String edgesPath, ExecutionEnvironment context) { return new GraphCsvReader(verticesPath, edgesPath, context); }
/** * Creates a graph from a CSV file of edges. Vertices will be created automatically. * * @param edgesPath a path to a CSV file with the Edges data * @param context the execution environment. * @return An instance of {@link org.apache.flink.graph.GraphCsvReader}, * on which calling methods to specify types of the Vertex ID, Vertex value and Edge value returns a Graph. * * @see org.apache.flink.graph.GraphCsvReader#types(Class, Class, Class) * @see org.apache.flink.graph.GraphCsvReader#vertexTypes(Class, Class) * @see org.apache.flink.graph.GraphCsvReader#edgeTypes(Class, Class) * @see org.apache.flink.graph.GraphCsvReader#keyType(Class) */ public static GraphCsvReader fromCsvReader(String edgesPath, ExecutionEnvironment context) { return new GraphCsvReader(edgesPath, context); }
/** * Creates a graph from a CSV file of edges. Vertices will be created automatically. * * @param edgesPath a path to a CSV file with the Edges data * @param context the execution environment. * @return An instance of {@link org.apache.flink.graph.GraphCsvReader}, * on which calling methods to specify types of the Vertex ID, Vertex value and Edge value returns a Graph. * * @see org.apache.flink.graph.GraphCsvReader#types(Class, Class, Class) * @see org.apache.flink.graph.GraphCsvReader#vertexTypes(Class, Class) * @see org.apache.flink.graph.GraphCsvReader#edgeTypes(Class, Class) * @see org.apache.flink.graph.GraphCsvReader#keyType(Class) */ public static GraphCsvReader fromCsvReader(String edgesPath, ExecutionEnvironment context) { return new GraphCsvReader(edgesPath, context); }
/** * Creates a Graph from a CSV file of vertices and a CSV file of edges. * * @param verticesPath path to a CSV file with the Vertex data. * @param edgesPath path to a CSV file with the Edge data * @param context the Flink execution environment. * @return An instance of {@link org.apache.flink.graph.GraphCsvReader}, * on which calling methods to specify types of the Vertex ID, Vertex value and Edge value returns a Graph. * * @see org.apache.flink.graph.GraphCsvReader#types(Class, Class, Class) * @see org.apache.flink.graph.GraphCsvReader#vertexTypes(Class, Class) * @see org.apache.flink.graph.GraphCsvReader#edgeTypes(Class, Class) * @see org.apache.flink.graph.GraphCsvReader#keyType(Class) */ public static GraphCsvReader fromCsvReader(String verticesPath, String edgesPath, ExecutionEnvironment context) { return new GraphCsvReader(verticesPath, edgesPath, context); }
/** * Creates a Graph from a CSV file of vertices and a CSV file of edges. * * @param verticesPath path to a CSV file with the Vertex data. * @param edgesPath path to a CSV file with the Edge data * @param context the Flink execution environment. * @return An instance of {@link org.apache.flink.graph.GraphCsvReader}, * on which calling methods to specify types of the Vertex ID, Vertex value and Edge value returns a Graph. * * @see org.apache.flink.graph.GraphCsvReader#types(Class, Class, Class) * @see org.apache.flink.graph.GraphCsvReader#vertexTypes(Class, Class) * @see org.apache.flink.graph.GraphCsvReader#edgeTypes(Class, Class) * @see org.apache.flink.graph.GraphCsvReader#keyType(Class) */ public static GraphCsvReader fromCsvReader(String verticesPath, String edgesPath, ExecutionEnvironment context) { return new GraphCsvReader(verticesPath, edgesPath, context); }
/** * Creates a graph from a CSV file of edges. Vertices will be created automatically and * Vertex values can be initialized using a user-defined mapper. * * @param edgesPath a path to a CSV file with the Edge data * @param vertexValueInitializer the mapper function that initializes the vertex values. * It allows to apply a map transformation on the vertex ID to produce an initial vertex value. * @param context the execution environment. * @return An instance of {@link org.apache.flink.graph.GraphCsvReader}, * on which calling methods to specify types of the Vertex ID, Vertex Value and Edge value returns a Graph. * * @see org.apache.flink.graph.GraphCsvReader#types(Class, Class, Class) * @see org.apache.flink.graph.GraphCsvReader#vertexTypes(Class, Class) * @see org.apache.flink.graph.GraphCsvReader#edgeTypes(Class, Class) * @see org.apache.flink.graph.GraphCsvReader#keyType(Class) */ public static <K, VV> GraphCsvReader fromCsvReader(String edgesPath, final MapFunction<K, VV> vertexValueInitializer, ExecutionEnvironment context) { return new GraphCsvReader(edgesPath, vertexValueInitializer, context); }
/** * Creates a graph from a CSV file of edges. Vertices will be created automatically and * Vertex values can be initialized using a user-defined mapper. * * @param edgesPath a path to a CSV file with the Edge data * @param vertexValueInitializer the mapper function that initializes the vertex values. * It allows to apply a map transformation on the vertex ID to produce an initial vertex value. * @param context the execution environment. * @return An instance of {@link org.apache.flink.graph.GraphCsvReader}, * on which calling methods to specify types of the Vertex ID, Vertex Value and Edge value returns a Graph. * * @see org.apache.flink.graph.GraphCsvReader#types(Class, Class, Class) * @see org.apache.flink.graph.GraphCsvReader#vertexTypes(Class, Class) * @see org.apache.flink.graph.GraphCsvReader#edgeTypes(Class, Class) * @see org.apache.flink.graph.GraphCsvReader#keyType(Class) */ public static <K, VV> GraphCsvReader fromCsvReader(String edgesPath, final MapFunction<K, VV> vertexValueInitializer, ExecutionEnvironment context) { return new GraphCsvReader(edgesPath, vertexValueInitializer, context); }
/** * Creates a graph from a CSV file of edges. Vertices will be created automatically and * Vertex values can be initialized using a user-defined mapper. * * @param edgesPath a path to a CSV file with the Edge data * @param vertexValueInitializer the mapper function that initializes the vertex values. * It allows to apply a map transformation on the vertex ID to produce an initial vertex value. * @param context the execution environment. * @return An instance of {@link org.apache.flink.graph.GraphCsvReader}, * on which calling methods to specify types of the Vertex ID, Vertex Value and Edge value returns a Graph. * * @see org.apache.flink.graph.GraphCsvReader#types(Class, Class, Class) * @see org.apache.flink.graph.GraphCsvReader#vertexTypes(Class, Class) * @see org.apache.flink.graph.GraphCsvReader#edgeTypes(Class, Class) * @see org.apache.flink.graph.GraphCsvReader#keyType(Class) */ public static <K, VV> GraphCsvReader fromCsvReader(String edgesPath, final MapFunction<K, VV> vertexValueInitializer, ExecutionEnvironment context) { return new GraphCsvReader(edgesPath, vertexValueInitializer, context); }