Created
July 26, 2016 00:09
-
-
Save solidpple/ef7709533ec86207b4775745bba75d5d to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
val links = sc.objectFile[(String, Seq[String])]("links").partitionBy(new HashPartitioner(100)).persist() | |
val ranks = links.mapValues(v => 1.0) | |
for (i <- 0 until 10) { | |
val contributions = links.join(ranks).flatMap { | |
case (pageId, (link, rank)) => | |
links.map(dest => (dest, rank / links.size)) | |
} | |
rank = contributions.reduceByKey((x, y) => x + y).mapValues(v => 0.15 + 0.85*v) | |
} | |
ranks.saveAsTextFile("ranks") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hi, I would appreciate if anyone provide me the ObjectFile that this script is running. Thanks in advance!