{"action":"created","comment":{"url":"https://api.github.com/repos/plofgren/cassovary/pulls/comments/38026883","id":38026883,"diff_hunk":"@@ -46,17 +46,18 @@ abstract class DynamicDirectedGraphHashMap(val storedGraphDir: StoredGraphDir)\n    * Get the total number of edges in the graph. It's a very slow function. Use it carefully.\n    */\n   def edgeCount = iterator.foldLeft(0) {(accum, node) =>\n-    accum + node.inboundCount  + node.outboundCount\n+    accum + (storedGraphDir match {\n+      case OnlyOut | BothInOut => node.outboundCount\n+      case OnlyIn => node.inboundCount\n+      case Mutual => 2 * node.outboundCount // count each edge twice","path":"cassovary-core/src/main/scala/com/twitter/cassovary/graph/DynamicDirectedGraphHashMap.scala","position":8,"original_position":8,"commit_id":"ec5e662b630e0a5010fe64e8cdb0471f0abadae1","original_commit_id":"ec5e662b630e0a5010fe64e8cdb0471f0abadae1","user":{"login":"ashishgpersonal","id":843109,"avatar_url":"https://avatars.githubusercontent.com/u/843109?v=3","gravatar_id":"","url":"https://api.github.com/users/ashishgpersonal","html_url":"https://github.com/ashishgpersonal","followers_url":"https://api.github.com/users/ashishgpersonal/followers","following_url":"https://api.github.com/users/ashishgpersonal/following{/other_user}","gists_url":"https://api.github.com/users/ashishgpersonal/gists{/gist_id}","starred_url":"https://api.github.com/users/ashishgpersonal/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ashishgpersonal/subscriptions","organizations_url":"https://api.github.com/users/ashishgpersonal/orgs","repos_url":"https://api.github.com/users/ashishgpersonal/repos","events_url":"https://api.github.com/users/ashishgpersonal/events{/privacy}","received_events_url":"https://api.github.com/users/ashishgpersonal/received_events","type":"User","site_admin":false},"body":"Shouldn't this be just outboundCount, since every edge is anyway being counted twice (once for each endpoint)?","created_at":"2015-08-26T19:53:27Z","updated_at":"2015-08-26T19:53:27Z","html_url":"https://github.com/plofgren/cassovary/pull/4#discussion_r38026883","pull_request_url":"https://api.github.com/repos/plofgren/cassovary/pulls/4","_links":{"self":{"href":"https://api.github.com/repos/plofgren/cassovary/pulls/comments/38026883"},"html":{"href":"https://github.com/plofgren/cassovary/pull/4#discussion_r38026883"},"pull_request":{"href":"https://api.github.com/repos/plofgren/cassovary/pulls/4"}}},"pull_request":{"url":"https://api.github.com/repos/plofgren/cassovary/pulls/4","id":43420627,"html_url":"https://github.com/plofgren/cassovary/pull/4","diff_url":"https://github.com/plofgren/cassovary/pull/4.diff","patch_url":"https://github.com/plofgren/cassovary/pull/4.patch","issue_url":"https://api.github.com/repos/plofgren/cassovary/issues/4","number":4,"state":"open","locked":false,"title":"Implement efficient dynamic graph for the case of concurrent reads an…","user":{"login":"plofgren","id":6324377,"avatar_url":"https://avatars.githubusercontent.com/u/6324377?v=3","gravatar_id":"","url":"https://api.github.com/users/plofgren","html_url":"https://github.com/plofgren","followers_url":"https://api.github.com/users/plofgren/followers","following_url":"https://api.github.com/users/plofgren/following{/other_user}","gists_url":"https://api.github.com/users/plofgren/gists{/gist_id}","starred_url":"https://api.github.com/users/plofgren/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/plofgren/subscriptions","organizations_url":"https://api.github.com/users/plofgren/orgs","repos_url":"https://api.github.com/users/plofgren/repos","events_url":"https://api.github.com/users/plofgren/events{/privacy}","received_events_url":"https://api.github.com/users/plofgren/received_events","type":"User","site_admin":false},"body":"…d single-threaded writes\r\n\r\n@ashishgpersonal When you have time, could you code review this?\r\nAlso, two questions:\r\n1. Currently addEdges does not check for duplicate edges, because e.g. if Obama gets a new in-neighbor I don't want to scan all his current in-neighbors, and I don't want the overhead of using hashMaps rather than arrays. I think duplicate edges should be rare enough for us to ignore for now--is that OK? It's not hard to add the check, it's just an efficiency question.\r\n2. I don't think it's easy to test race conditions without inserting artificial Thread.sleep calls. Could you look carefully at the append method in SemiSynchronizedIntArrayList and see if you think it's thread safe with concurrent readers?\r\n\r\nThanks.","created_at":"2015-08-26T16:09:47Z","updated_at":"2015-08-26T19:53:27Z","closed_at":null,"merged_at":null,"merge_commit_sha":"9fb01c1fea225e8fbd33157c9ca08df7bbdfedfc","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/plofgren/cassovary/pulls/4/commits","review_comments_url":"https://api.github.com/repos/plofgren/cassovary/pulls/4/comments","review_comment_url":"https://api.github.com/repos/plofgren/cassovary/pulls/comments{/number}","comments_url":"https://api.github.com/repos/plofgren/cassovary/issues/4/comments","statuses_url":"https://api.github.com/repos/plofgren/cassovary/statuses/ec5e662b630e0a5010fe64e8cdb0471f0abadae1","head":{"label":"plofgren:plofgren-efficient-hashmap-dynamic-graph","ref":"plofgren-efficient-hashmap-dynamic-graph","sha":"ec5e662b630e0a5010fe64e8cdb0471f0abadae1","user":{"login":"plofgren","id":6324377,"avatar_url":"https://avatars.githubusercontent.com/u/6324377?v=3","gravatar_id":"","url":"https://api.github.com/users/plofgren","html_url":"https://github.com/plofgren","followers_url":"https://api.github.com/users/plofgren/followers","following_url":"https://api.github.com/users/plofgren/following{/other_user}","gists_url":"https://api.github.com/users/plofgren/gists{/gist_id}","starred_url":"https://api.github.com/users/plofgren/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/plofgren/subscriptions","organizations_url":"https://api.github.com/users/plofgren/orgs","repos_url":"https://api.github.com/users/plofgren/repos","events_url":"https://api.github.com/users/plofgren/events{/privacy}","received_events_url":"https://api.github.com/users/plofgren/received_events","type":"User","site_admin":false},"repo":{"id":29319928,"name":"cassovary","full_name":"plofgren/cassovary","owner":{"login":"plofgren","id":6324377,"avatar_url":"https://avatars.githubusercontent.com/u/6324377?v=3","gravatar_id":"","url":"https://api.github.com/users/plofgren","html_url":"https://github.com/plofgren","followers_url":"https://api.github.com/users/plofgren/followers","following_url":"https://api.github.com/users/plofgren/following{/other_user}","gists_url":"https://api.github.com/users/plofgren/gists{/gist_id}","starred_url":"https://api.github.com/users/plofgren/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/plofgren/subscriptions","organizations_url":"https://api.github.com/users/plofgren/orgs","repos_url":"https://api.github.com/users/plofgren/repos","events_url":"https://api.github.com/users/plofgren/events{/privacy}","received_events_url":"https://api.github.com/users/plofgren/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/plofgren/cassovary","description":"Cassovary is a simple big graph processing library for the JVM","fork":true,"url":"https://api.github.com/repos/plofgren/cassovary","forks_url":"https://api.github.com/repos/plofgren/cassovary/forks","keys_url":"https://api.github.com/repos/plofgren/cassovary/keys{/key_id}","collaborators_url":"https://api.github.com/repos/plofgren/cassovary/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/plofgren/cassovary/teams","hooks_url":"https://api.github.com/repos/plofgren/cassovary/hooks","issue_events_url":"https://api.github.com/repos/plofgren/cassovary/issues/events{/number}","events_url":"https://api.github.com/repos/plofgren/cassovary/events","assignees_url":"https://api.github.com/repos/plofgren/cassovary/assignees{/user}","branches_url":"https://api.github.com/repos/plofgren/cassovary/branches{/branch}","tags_url":"https://api.github.com/repos/plofgren/cassovary/tags","blobs_url":"https://api.github.com/repos/plofgren/cassovary/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/plofgren/cassovary/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/plofgren/cassovary/git/refs{/sha}","trees_url":"https://api.github.com/repos/plofgren/cassovary/git/trees{/sha}","statuses_url":"https://api.github.com/repos/plofgren/cassovary/statuses/{sha}","languages_url":"https://api.github.com/repos/plofgren/cassovary/languages","stargazers_url":"https://api.github.com/repos/plofgren/cassovary/stargazers","contributors_url":"https://api.github.com/repos/plofgren/cassovary/contributors","subscribers_url":"https://api.github.com/repos/plofgren/cassovary/subscribers","subscription_url":"https://api.github.com/repos/plofgren/cassovary/subscription","commits_url":"https://api.github.com/repos/plofgren/cassovary/commits{/sha}","git_commits_url":"https://api.github.com/repos/plofgren/cassovary/git/commits{/sha}","comments_url":"https://api.github.com/repos/plofgren/cassovary/comments{/number}","issue_comment_url":"https://api.github.com/repos/plofgren/cassovary/issues/comments{/number}","contents_url":"https://api.github.com/repos/plofgren/cassovary/contents/{+path}","compare_url":"https://api.github.com/repos/plofgren/cassovary/compare/{base}...{head}","merges_url":"https://api.github.com/repos/plofgren/cassovary/merges","archive_url":"https://api.github.com/repos/plofgren/cassovary/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/plofgren/cassovary/downloads","issues_url":"https://api.github.com/repos/plofgren/cassovary/issues{/number}","pulls_url":"https://api.github.com/repos/plofgren/cassovary/pulls{/number}","milestones_url":"https://api.github.com/repos/plofgren/cassovary/milestones{/number}","notifications_url":"https://api.github.com/repos/plofgren/cassovary/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/plofgren/cassovary/labels{/name}","releases_url":"https://api.github.com/repos/plofgren/cassovary/releases{/id}","created_at":"2015-01-15T21:49:58Z","updated_at":"2015-04-12T16:35:09Z","pushed_at":"2015-08-26T16:09:48Z","git_url":"git://github.com/plofgren/cassovary.git","ssh_url":"git@github.com:plofgren/cassovary.git","clone_url":"https://github.com/plofgren/cassovary.git","svn_url":"https://github.com/plofgren/cassovary","homepage":"http://twitter.com/cassovary","size":2845,"stargazers_count":0,"watchers_count":0,"language":"Scala","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":3,"forks":0,"open_issues":3,"watchers":0,"default_branch":"master"}},"base":{"label":"plofgren:master","ref":"master","sha":"84d0d2be2c34eaf622c0f6727e38f1c901b9347b","user":{"login":"plofgren","id":6324377,"avatar_url":"https://avatars.githubusercontent.com/u/6324377?v=3","gravatar_id":"","url":"https://api.github.com/users/plofgren","html_url":"https://github.com/plofgren","followers_url":"https://api.github.com/users/plofgren/followers","following_url":"https://api.github.com/users/plofgren/following{/other_user}","gists_url":"https://api.github.com/users/plofgren/gists{/gist_id}","starred_url":"https://api.github.com/users/plofgren/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/plofgren/subscriptions","organizations_url":"https://api.github.com/users/plofgren/orgs","repos_url":"https://api.github.com/users/plofgren/repos","events_url":"https://api.github.com/users/plofgren/events{/privacy}","received_events_url":"https://api.github.com/users/plofgren/received_events","type":"User","site_admin":false},"repo":{"id":29319928,"name":"cassovary","full_name":"plofgren/cassovary","owner":{"login":"plofgren","id":6324377,"avatar_url":"https://avatars.githubusercontent.com/u/6324377?v=3","gravatar_id":"","url":"https://api.github.com/users/plofgren","html_url":"https://github.com/plofgren","followers_url":"https://api.github.com/users/plofgren/followers","following_url":"https://api.github.com/users/plofgren/following{/other_user}","gists_url":"https://api.github.com/users/plofgren/gists{/gist_id}","starred_url":"https://api.github.com/users/plofgren/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/plofgren/subscriptions","organizations_url":"https://api.github.com/users/plofgren/orgs","repos_url":"https://api.github.com/users/plofgren/repos","events_url":"https://api.github.com/users/plofgren/events{/privacy}","received_events_url":"https://api.github.com/users/plofgren/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/plofgren/cassovary","description":"Cassovary is a simple big graph processing library for the JVM","fork":true,"url":"https://api.github.com/repos/plofgren/cassovary","forks_url":"https://api.github.com/repos/plofgren/cassovary/forks","keys_url":"https://api.github.com/repos/plofgren/cassovary/keys{/key_id}","collaborators_url":"https://api.github.com/repos/plofgren/cassovary/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/plofgren/cassovary/teams","hooks_url":"https://api.github.com/repos/plofgren/cassovary/hooks","issue_events_url":"https://api.github.com/repos/plofgren/cassovary/issues/events{/number}","events_url":"https://api.github.com/repos/plofgren/cassovary/events","assignees_url":"https://api.github.com/repos/plofgren/cassovary/assignees{/user}","branches_url":"https://api.github.com/repos/plofgren/cassovary/branches{/branch}","tags_url":"https://api.github.com/repos/plofgren/cassovary/tags","blobs_url":"https://api.github.com/repos/plofgren/cassovary/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/plofgren/cassovary/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/plofgren/cassovary/git/refs{/sha}","trees_url":"https://api.github.com/repos/plofgren/cassovary/git/trees{/sha}","statuses_url":"https://api.github.com/repos/plofgren/cassovary/statuses/{sha}","languages_url":"https://api.github.com/repos/plofgren/cassovary/languages","stargazers_url":"https://api.github.com/repos/plofgren/cassovary/stargazers","contributors_url":"https://api.github.com/repos/plofgren/cassovary/contributors","subscribers_url":"https://api.github.com/repos/plofgren/cassovary/subscribers","subscription_url":"https://api.github.com/repos/plofgren/cassovary/subscription","commits_url":"https://api.github.com/repos/plofgren/cassovary/commits{/sha}","git_commits_url":"https://api.github.com/repos/plofgren/cassovary/git/commits{/sha}","comments_url":"https://api.github.com/repos/plofgren/cassovary/comments{/number}","issue_comment_url":"https://api.github.com/repos/plofgren/cassovary/issues/comments{/number}","contents_url":"https://api.github.com/repos/plofgren/cassovary/contents/{+path}","compare_url":"https://api.github.com/repos/plofgren/cassovary/compare/{base}...{head}","merges_url":"https://api.github.com/repos/plofgren/cassovary/merges","archive_url":"https://api.github.com/repos/plofgren/cassovary/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/plofgren/cassovary/downloads","issues_url":"https://api.github.com/repos/plofgren/cassovary/issues{/number}","pulls_url":"https://api.github.com/repos/plofgren/cassovary/pulls{/number}","milestones_url":"https://api.github.com/repos/plofgren/cassovary/milestones{/number}","notifications_url":"https://api.github.com/repos/plofgren/cassovary/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/plofgren/cassovary/labels{/name}","releases_url":"https://api.github.com/repos/plofgren/cassovary/releases{/id}","created_at":"2015-01-15T21:49:58Z","updated_at":"2015-04-12T16:35:09Z","pushed_at":"2015-08-26T16:09:48Z","git_url":"git://github.com/plofgren/cassovary.git","ssh_url":"git@github.com:plofgren/cassovary.git","clone_url":"https://github.com/plofgren/cassovary.git","svn_url":"https://github.com/plofgren/cassovary","homepage":"http://twitter.com/cassovary","size":2845,"stargazers_count":0,"watchers_count":0,"language":"Scala","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":3,"forks":0,"open_issues":3,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/plofgren/cassovary/pulls/4"},"html":{"href":"https://github.com/plofgren/cassovary/pull/4"},"issue":{"href":"https://api.github.com/repos/plofgren/cassovary/issues/4"},"comments":{"href":"https://api.github.com/repos/plofgren/cassovary/issues/4/comments"},"review_comments":{"href":"https://api.github.com/repos/plofgren/cassovary/pulls/4/comments"},"review_comment":{"href":"https://api.github.com/repos/plofgren/cassovary/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/plofgren/cassovary/pulls/4/commits"},"statuses":{"href":"https://api.github.com/repos/plofgren/cassovary/statuses/ec5e662b630e0a5010fe64e8cdb0471f0abadae1"}}}}