/** * Runs a {@link VertexCentricIteration} on the graph. * No configuration options are provided. * * @param computeFunction the vertex compute function * @param combiner an optional message combiner * @param maximumNumberOfIterations maximum number of iterations to perform * * @return the updated Graph after the vertex-centric iteration has converged or * after maximumNumberOfIterations. */ public <M> Graph<K, VV, EV> runVertexCentricIteration( ComputeFunction<K, VV, EV, M> computeFunction, MessageCombiner<K, M> combiner, int maximumNumberOfIterations) { return this.runVertexCentricIteration(computeFunction, combiner, maximumNumberOfIterations, null); }
public static void main(String[] args) throws Exception { if (!parseParameters(args)) { return; } ExecutionEnvironment env = ExecutionEnvironment.getExecutionEnvironment(); DataSet<Edge<Long, Double>> edges = getEdgesDataSet(env); Graph<Long, Double, Double> graph = Graph.fromDataSet(edges, new InitVertices(), env); // Execute the vertex-centric iteration Graph<Long, Double, Double> result = graph.runVertexCentricIteration( new SSSPComputeFunction(srcVertexId), new SSSPCombiner(), maxIterations); // Extract the vertices as the result DataSet<Vertex<Long, Double>> singleSourceShortestPaths = result.getVertices(); // emit result if (fileOutput) { singleSourceShortestPaths.writeAsCsv(outputPath, "\n", ","); env.execute("Pregel Single Source Shortest Paths Example"); } else { singleSourceShortestPaths.print(); } }
/** * Runs a {@link VertexCentricIteration} on the graph. * No configuration options are provided. * * @param computeFunction the vertex compute function * @param combiner an optional message combiner * @param maximumNumberOfIterations maximum number of iterations to perform * * @return the updated Graph after the vertex-centric iteration has converged or * after maximumNumberOfIterations. */ public <M> Graph<K, VV, EV> runVertexCentricIteration( ComputeFunction<K, VV, EV, M> computeFunction, MessageCombiner<K, M> combiner, int maximumNumberOfIterations) { return this.runVertexCentricIteration(computeFunction, combiner, maximumNumberOfIterations, null); }
/** * Runs a {@link VertexCentricIteration} on the graph. * No configuration options are provided. * * @param computeFunction the vertex compute function * @param combiner an optional message combiner * @param maximumNumberOfIterations maximum number of iterations to perform * * @return the updated Graph after the vertex-centric iteration has converged or * after maximumNumberOfIterations. */ public <M> Graph<K, VV, EV> runVertexCentricIteration( ComputeFunction<K, VV, EV, M> computeFunction, MessageCombiner<K, M> combiner, int maximumNumberOfIterations) { return this.runVertexCentricIteration(computeFunction, combiner, maximumNumberOfIterations, null); }
/** * Runs a {@link VertexCentricIteration} on the graph. * No configuration options are provided. * * @param computeFunction the vertex compute function * @param combiner an optional message combiner * @param maximumNumberOfIterations maximum number of iterations to perform * * @return the updated Graph after the vertex-centric iteration has converged or * after maximumNumberOfIterations. */ public <M> Graph<K, VV, EV> runVertexCentricIteration( ComputeFunction<K, VV, EV, M> computeFunction, MessageCombiner<K, M> combiner, int maximumNumberOfIterations) { return this.runVertexCentricIteration(computeFunction, combiner, maximumNumberOfIterations, null); }