Skip to content

Instantly share code, notes, and snippets.

@s1ck
Last active March 14, 2016 16:52
Show Gist options
  • Save s1ck/801a8ef97ce374b358df to your computer and use it in GitHub Desktop.
Save s1ck/801a8ef97ce374b358df to your computer and use it in GitHub Desktop.
Example PageRank with custom scatter gather conf
// your code to create vertices and edges
Graph<Long, Double, Double> graph = Graph.fromDataSet(vertices, edges, env);
ScatterGatherConfiguration conf = new ScatterGatherConfiguration();
conf.setSolutionSetUnmanagedMemory(true);
long vertexCount = graph.numberOfVertices();
Graph<Long, Double, Double> ranks = graph.runScatterGatherIteration(
new PageRank.VertexRankUpdater<>(0.85, vertexCount),
new PageRank.RankMessenger<>(vertexCount),
5,
conf);
ranks.getVertices().print();
@ovidiumarcu
Copy link

I am using this:
DataSet<Vertex<Long, Double>> result = inputGraph.run(new PageRank(0.85, numberIterations));
result.writeAsCsv(outputPath, "\n", " ", WriteMode.OVERWRITE);

I don't have runScatterGatherIteration, my version is 0.10.
Is your code using 1.0 version?

@s1ck
Copy link
Author

s1ck commented Mar 14, 2016

Hi, in 0.10.2 it's

VertexCentricConfiguration conf = new VertexCentricConfiguration();
conf.setSolutionSetUnmanagedMemory(true);

long vertexCount = graph.numberOfVertices();

Graph<Long, Double, Double> ranks = graph.runVertexCentricIteration(
  new PageRank.VertexRankUpdater<>(0.85, vertexCount),
  new PageRank.RankMessenger<>(vertexCount), 5, conf);

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment