{"action":"created","comment":{"url":"https://api.github.com/repos/harvard-cs205/cs205-homework/pulls/comments/42929378","id":42929378,"diff_hunk":"@@ -0,0 +1,44 @@\n+def BFS(sc, graph, name):\n+\n+    # Note: on the Virtual machine, things work best if everything is partitioned into 2.  \n+    \n+    # Rdd of name, shortest distance tuples that will be returned.  In each iteration, heros are added to this.  Initialize with the source node, and partition into 2 partitions to match the graph.\n+    rdd = sc.parallelize([(name, 0)], 2).cache()\n+    \n+    # This RDD is used intermediately to build a collection of connections to build on\n+    namesRdd = rdd\n+\n+    # Iterator used in the while loop\n+    i = 0\n+       \n+    acc = sc.accumulator(0)    \n+\n+    while acc.value == 0:\n+\n+        i+=1\n+\n+        # Use join to look up the connections of the next round of connections\n+        namesRdd = graph.join(namesRdd)\n+\n+        # Use mapValues to take just the list of connections and remove the distance\n+        namesRdd = namesRdd.mapValues(lambda (x,y): x).partitionBy(2)\n+\n+        # Take the connections and flatMap them into one big pool to consider\n+        namesRdd = namesRdd.values().flatMap(lambda x: x)\n+\n+        # Reduce the connections to distinct entries\n+        namesRdd = namesRdd.distinct()\n+        \n+        # Subtract out the names that are already in the rdd\n+        namesRdd = namesRdd.subtract(rdd.keys())\n+        ","path":"HW1/P4/P4_bfs.py","position":34,"original_position":34,"commit_id":"68a5335c4745134d1a052e46146b1a3fe1bb4875","original_commit_id":"68a5335c4745134d1a052e46146b1a3fe1bb4875","user":{"login":"jeewon-hwang","id":14130448,"avatar_url":"https://avatars.githubusercontent.com/u/14130448?v=3","gravatar_id":"","url":"https://api.github.com/users/jeewon-hwang","html_url":"https://github.com/jeewon-hwang","followers_url":"https://api.github.com/users/jeewon-hwang/followers","following_url":"https://api.github.com/users/jeewon-hwang/following{/other_user}","gists_url":"https://api.github.com/users/jeewon-hwang/gists{/gist_id}","starred_url":"https://api.github.com/users/jeewon-hwang/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jeewon-hwang/subscriptions","organizations_url":"https://api.github.com/users/jeewon-hwang/orgs","repos_url":"https://api.github.com/users/jeewon-hwang/repos","events_url":"https://api.github.com/users/jeewon-hwang/events{/privacy}","received_events_url":"https://api.github.com/users/jeewon-hwang/received_events","type":"User","site_admin":false},"body":"Oh, I appreciate I could learn from you those built-in methods in spark. I didn't use either rdd.union nor rdd.substract. If I knew them, I would have tried it. I implemented them in a little bit more complicated way... using set and lists. ","created_at":"2015-10-24T03:04:52Z","updated_at":"2015-10-24T03:04:52Z","html_url":"https://github.com/harvard-cs205/cs205-homework/pull/237#discussion_r42929378","pull_request_url":"https://api.github.com/repos/harvard-cs205/cs205-homework/pulls/237","_links":{"self":{"href":"https://api.github.com/repos/harvard-cs205/cs205-homework/pulls/comments/42929378"},"html":{"href":"https://github.com/harvard-cs205/cs205-homework/pull/237#discussion_r42929378"},"pull_request":{"href":"https://api.github.com/repos/harvard-cs205/cs205-homework/pulls/237"}}},"pull_request":{"url":"https://api.github.com/repos/harvard-cs205/cs205-homework/pulls/237","id":46743000,"html_url":"https://github.com/harvard-cs205/cs205-homework/pull/237","diff_url":"https://github.com/harvard-cs205/cs205-homework/pull/237.diff","patch_url":"https://github.com/harvard-cs205/cs205-homework/pull/237.patch","issue_url":"https://api.github.com/repos/harvard-cs205/cs205-homework/issues/237","number":237,"state":"open","locked":false,"title":"Hw1","user":{"login":"christianjunge","id":14099308,"avatar_url":"https://avatars.githubusercontent.com/u/14099308?v=3","gravatar_id":"","url":"https://api.github.com/users/christianjunge","html_url":"https://github.com/christianjunge","followers_url":"https://api.github.com/users/christianjunge/followers","following_url":"https://api.github.com/users/christianjunge/following{/other_user}","gists_url":"https://api.github.com/users/christianjunge/gists{/gist_id}","starred_url":"https://api.github.com/users/christianjunge/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/christianjunge/subscriptions","organizations_url":"https://api.github.com/users/christianjunge/orgs","repos_url":"https://api.github.com/users/christianjunge/repos","events_url":"https://api.github.com/users/christianjunge/events{/privacy}","received_events_url":"https://api.github.com/users/christianjunge/received_events","type":"User","site_admin":false},"body":"I have several changes that I wasn't able to push to the origin... After a lot of work on problem 5, I tried to do an add/commit/push, but got a failure because the P5 folder contained the very large zip files for the wikipedia pages.  I removed these from my local directory and tried to add/commit/push again, but after trying to add and commit, I receive a message that my working directory is clean and there is nothing to commit.  And when I try to push, I still receive the large file error, even though it's not present in my local directory or the online repo.  \r\n\r\nSo a few updates to P4 and all the fruitless work I did on P5 don't appear in this submission.  ","created_at":"2015-10-05T04:05:48Z","updated_at":"2015-10-24T03:04:52Z","closed_at":null,"merged_at":null,"merge_commit_sha":"71f258b0e544840fb4d2786329b6f6aa94ba2287","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/harvard-cs205/cs205-homework/pulls/237/commits","review_comments_url":"https://api.github.com/repos/harvard-cs205/cs205-homework/pulls/237/comments","review_comment_url":"https://api.github.com/repos/harvard-cs205/cs205-homework/pulls/comments{/number}","comments_url":"https://api.github.com/repos/harvard-cs205/cs205-homework/issues/237/comments","statuses_url":"https://api.github.com/repos/harvard-cs205/cs205-homework/statuses/68a5335c4745134d1a052e46146b1a3fe1bb4875","head":{"label":"christianjunge:HW1","ref":"HW1","sha":"68a5335c4745134d1a052e46146b1a3fe1bb4875","user":{"login":"christianjunge","id":14099308,"avatar_url":"https://avatars.githubusercontent.com/u/14099308?v=3","gravatar_id":"","url":"https://api.github.com/users/christianjunge","html_url":"https://github.com/christianjunge","followers_url":"https://api.github.com/users/christianjunge/followers","following_url":"https://api.github.com/users/christianjunge/following{/other_user}","gists_url":"https://api.github.com/users/christianjunge/gists{/gist_id}","starred_url":"https://api.github.com/users/christianjunge/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/christianjunge/subscriptions","organizations_url":"https://api.github.com/users/christianjunge/orgs","repos_url":"https://api.github.com/users/christianjunge/repos","events_url":"https://api.github.com/users/christianjunge/events{/privacy}","received_events_url":"https://api.github.com/users/christianjunge/received_events","type":"User","site_admin":false},"repo":{"id":41970087,"name":"cs205-homework","full_name":"christianjunge/cs205-homework","owner":{"login":"christianjunge","id":14099308,"avatar_url":"https://avatars.githubusercontent.com/u/14099308?v=3","gravatar_id":"","url":"https://api.github.com/users/christianjunge","html_url":"https://github.com/christianjunge","followers_url":"https://api.github.com/users/christianjunge/followers","following_url":"https://api.github.com/users/christianjunge/following{/other_user}","gists_url":"https://api.github.com/users/christianjunge/gists{/gist_id}","starred_url":"https://api.github.com/users/christianjunge/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/christianjunge/subscriptions","organizations_url":"https://api.github.com/users/christianjunge/orgs","repos_url":"https://api.github.com/users/christianjunge/repos","events_url":"https://api.github.com/users/christianjunge/events{/privacy}","received_events_url":"https://api.github.com/users/christianjunge/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/christianjunge/cs205-homework","description":"","fork":true,"url":"https://api.github.com/repos/christianjunge/cs205-homework","forks_url":"https://api.github.com/repos/christianjunge/cs205-homework/forks","keys_url":"https://api.github.com/repos/christianjunge/cs205-homework/keys{/key_id}","collaborators_url":"https://api.github.com/repos/christianjunge/cs205-homework/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/christianjunge/cs205-homework/teams","hooks_url":"https://api.github.com/repos/christianjunge/cs205-homework/hooks","issue_events_url":"https://api.github.com/repos/christianjunge/cs205-homework/issues/events{/number}","events_url":"https://api.github.com/repos/christianjunge/cs205-homework/events","assignees_url":"https://api.github.com/repos/christianjunge/cs205-homework/assignees{/user}","branches_url":"https://api.github.com/repos/christianjunge/cs205-homework/branches{/branch}","tags_url":"https://api.github.com/repos/christianjunge/cs205-homework/tags","blobs_url":"https://api.github.com/repos/christianjunge/cs205-homework/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/christianjunge/cs205-homework/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/christianjunge/cs205-homework/git/refs{/sha}","trees_url":"https://api.github.com/repos/christianjunge/cs205-homework/git/trees{/sha}","statuses_url":"https://api.github.com/repos/christianjunge/cs205-homework/statuses/{sha}","languages_url":"https://api.github.com/repos/christianjunge/cs205-homework/languages","stargazers_url":"https://api.github.com/repos/christianjunge/cs205-homework/stargazers","contributors_url":"https://api.github.com/repos/christianjunge/cs205-homework/contributors","subscribers_url":"https://api.github.com/repos/christianjunge/cs205-homework/subscribers","subscription_url":"https://api.github.com/repos/christianjunge/cs205-homework/subscription","commits_url":"https://api.github.com/repos/christianjunge/cs205-homework/commits{/sha}","git_commits_url":"https://api.github.com/repos/christianjunge/cs205-homework/git/commits{/sha}","comments_url":"https://api.github.com/repos/christianjunge/cs205-homework/comments{/number}","issue_comment_url":"https://api.github.com/repos/christianjunge/cs205-homework/issues/comments{/number}","contents_url":"https://api.github.com/repos/christianjunge/cs205-homework/contents/{+path}","compare_url":"https://api.github.com/repos/christianjunge/cs205-homework/compare/{base}...{head}","merges_url":"https://api.github.com/repos/christianjunge/cs205-homework/merges","archive_url":"https://api.github.com/repos/christianjunge/cs205-homework/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/christianjunge/cs205-homework/downloads","issues_url":"https://api.github.com/repos/christianjunge/cs205-homework/issues{/number}","pulls_url":"https://api.github.com/repos/christianjunge/cs205-homework/pulls{/number}","milestones_url":"https://api.github.com/repos/christianjunge/cs205-homework/milestones{/number}","notifications_url":"https://api.github.com/repos/christianjunge/cs205-homework/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/christianjunge/cs205-homework/labels{/name}","releases_url":"https://api.github.com/repos/christianjunge/cs205-homework/releases{/id}","created_at":"2015-09-05T17:43:53Z","updated_at":"2015-09-05T17:43:53Z","pushed_at":"2015-10-05T16:08:06Z","git_url":"git://github.com/christianjunge/cs205-homework.git","ssh_url":"git@github.com:christianjunge/cs205-homework.git","clone_url":"https://github.com/christianjunge/cs205-homework.git","svn_url":"https://github.com/christianjunge/cs205-homework","homepage":null,"size":3127,"stargazers_count":0,"watchers_count":0,"language":"Python","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"harvard-cs205:master","ref":"master","sha":"406f864b38a6c8a3d89cba66cb5228e98907bab7","user":{"login":"harvard-cs205","id":13456002,"avatar_url":"https://avatars.githubusercontent.com/u/13456002?v=3","gravatar_id":"","url":"https://api.github.com/users/harvard-cs205","html_url":"https://github.com/harvard-cs205","followers_url":"https://api.github.com/users/harvard-cs205/followers","following_url":"https://api.github.com/users/harvard-cs205/following{/other_user}","gists_url":"https://api.github.com/users/harvard-cs205/gists{/gist_id}","starred_url":"https://api.github.com/users/harvard-cs205/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/harvard-cs205/subscriptions","organizations_url":"https://api.github.com/users/harvard-cs205/orgs","repos_url":"https://api.github.com/users/harvard-cs205/repos","events_url":"https://api.github.com/users/harvard-cs205/events{/privacy}","received_events_url":"https://api.github.com/users/harvard-cs205/received_events","type":"Organization","site_admin":false},"repo":{"id":40614104,"name":"cs205-homework","full_name":"harvard-cs205/cs205-homework","owner":{"login":"harvard-cs205","id":13456002,"avatar_url":"https://avatars.githubusercontent.com/u/13456002?v=3","gravatar_id":"","url":"https://api.github.com/users/harvard-cs205","html_url":"https://github.com/harvard-cs205","followers_url":"https://api.github.com/users/harvard-cs205/followers","following_url":"https://api.github.com/users/harvard-cs205/following{/other_user}","gists_url":"https://api.github.com/users/harvard-cs205/gists{/gist_id}","starred_url":"https://api.github.com/users/harvard-cs205/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/harvard-cs205/subscriptions","organizations_url":"https://api.github.com/users/harvard-cs205/orgs","repos_url":"https://api.github.com/users/harvard-cs205/repos","events_url":"https://api.github.com/users/harvard-cs205/events{/privacy}","received_events_url":"https://api.github.com/users/harvard-cs205/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/harvard-cs205/cs205-homework","description":"","fork":false,"url":"https://api.github.com/repos/harvard-cs205/cs205-homework","forks_url":"https://api.github.com/repos/harvard-cs205/cs205-homework/forks","keys_url":"https://api.github.com/repos/harvard-cs205/cs205-homework/keys{/key_id}","collaborators_url":"https://api.github.com/repos/harvard-cs205/cs205-homework/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/harvard-cs205/cs205-homework/teams","hooks_url":"https://api.github.com/repos/harvard-cs205/cs205-homework/hooks","issue_events_url":"https://api.github.com/repos/harvard-cs205/cs205-homework/issues/events{/number}","events_url":"https://api.github.com/repos/harvard-cs205/cs205-homework/events","assignees_url":"https://api.github.com/repos/harvard-cs205/cs205-homework/assignees{/user}","branches_url":"https://api.github.com/repos/harvard-cs205/cs205-homework/branches{/branch}","tags_url":"https://api.github.com/repos/harvard-cs205/cs205-homework/tags","blobs_url":"https://api.github.com/repos/harvard-cs205/cs205-homework/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/harvard-cs205/cs205-homework/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/harvard-cs205/cs205-homework/git/refs{/sha}","trees_url":"https://api.github.com/repos/harvard-cs205/cs205-homework/git/trees{/sha}","statuses_url":"https://api.github.com/repos/harvard-cs205/cs205-homework/statuses/{sha}","languages_url":"https://api.github.com/repos/harvard-cs205/cs205-homework/languages","stargazers_url":"https://api.github.com/repos/harvard-cs205/cs205-homework/stargazers","contributors_url":"https://api.github.com/repos/harvard-cs205/cs205-homework/contributors","subscribers_url":"https://api.github.com/repos/harvard-cs205/cs205-homework/subscribers","subscription_url":"https://api.github.com/repos/harvard-cs205/cs205-homework/subscription","commits_url":"https://api.github.com/repos/harvard-cs205/cs205-homework/commits{/sha}","git_commits_url":"https://api.github.com/repos/harvard-cs205/cs205-homework/git/commits{/sha}","comments_url":"https://api.github.com/repos/harvard-cs205/cs205-homework/comments{/number}","issue_comment_url":"https://api.github.com/repos/harvard-cs205/cs205-homework/issues/comments{/number}","contents_url":"https://api.github.com/repos/harvard-cs205/cs205-homework/contents/{+path}","compare_url":"https://api.github.com/repos/harvard-cs205/cs205-homework/compare/{base}...{head}","merges_url":"https://api.github.com/repos/harvard-cs205/cs205-homework/merges","archive_url":"https://api.github.com/repos/harvard-cs205/cs205-homework/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/harvard-cs205/cs205-homework/downloads","issues_url":"https://api.github.com/repos/harvard-cs205/cs205-homework/issues{/number}","pulls_url":"https://api.github.com/repos/harvard-cs205/cs205-homework/pulls{/number}","milestones_url":"https://api.github.com/repos/harvard-cs205/cs205-homework/milestones{/number}","notifications_url":"https://api.github.com/repos/harvard-cs205/cs205-homework/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/harvard-cs205/cs205-homework/labels{/name}","releases_url":"https://api.github.com/repos/harvard-cs205/cs205-homework/releases{/id}","created_at":"2015-08-12T17:18:15Z","updated_at":"2015-10-21T19:21:28Z","pushed_at":"2015-10-21T20:18:24Z","git_url":"git://github.com/harvard-cs205/cs205-homework.git","ssh_url":"git@github.com:harvard-cs205/cs205-homework.git","clone_url":"https://github.com/harvard-cs205/cs205-homework.git","svn_url":"https://github.com/harvard-cs205/cs205-homework","homepage":null,"size":84763,"stargazers_count":5,"watchers_count":5,"language":"C","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":99,"mirror_url":null,"open_issues_count":267,"forks":99,"open_issues":267,"watchers":5,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/harvard-cs205/cs205-homework/pulls/237"},"html":{"href":"https://github.com/harvard-cs205/cs205-homework/pull/237"},"issue":{"href":"https://api.github.com/repos/harvard-cs205/cs205-homework/issues/237"},"comments":{"href":"https://api.github.com/repos/harvard-cs205/cs205-homework/issues/237/comments"},"review_comments":{"href":"https://api.github.com/repos/harvard-cs205/cs205-homework/pulls/237/comments"},"review_comment":{"href":"https://api.github.com/repos/harvard-cs205/cs205-homework/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/harvard-cs205/cs205-homework/pulls/237/commits"},"statuses":{"href":"https://api.github.com/repos/harvard-cs205/cs205-homework/statuses/68a5335c4745134d1a052e46146b1a3fe1bb4875"}}}}