Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Load and initialize the graph
- val graph = Graph.load('hdfs://webgraph.tsv')
- var prGraph = graph.updateV(graph.degrees(OutEdges),
- (v,deg) => (v.id,(deg, 1.0)) // Initial rank=1
- // Execute PageRank
- prGraph = Pregel(prGraph,
- 1.0, // Initial message is 1.0
- vprogf = // Update Rank
- (v, msg) => (v.deg, 0.15 + 0.85 * msg),
- sendMsgf = // Compute Msg
- e => e.src.rank/e.src.deg,
- combinef = // Combine msg
- (m1, m2) => m1 + m2,
- 10) // Run 10 iterations
- // Display the maximum PageRank
- print(prGraph.vertices.map(v=>v.rank).max)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement