{"action":"created","comment":{"url":"https://api.github.com/repos/networkx/networkx/pulls/comments/32376355","id":32376355,"diff_hunk":"@@ -0,0 +1,84 @@\n+# -*- coding: utf-8 -*-\n+#    Copyright (C) 2015\n+#    All rights reserved.\n+#    BSD license.\n+\n+import random\n+import networkx as nx\n+from itertools import groupby\n+from collections import Counter\n+\n+\n+def asyn_lpa_communities(G, weight=None):\n+    \"\"\"\n+    Asynchronous label propagation algorithm for community detection described\n+    on [1]_. The algorithm is non-deterministic and the found communities may\n+    vary on different executions.\n+\n+    The algorithm follows these steps:\n+\n+        1. Initialize the labels at all nodes in the network giving them unique\n+        identifiers.","path":"networkx/algorithms/community/asyn_lpa.py","position":21,"original_position":21,"commit_id":"e46a998fd9a24c0b5587b45ac1d7780828db7ec8","original_commit_id":"e46a998fd9a24c0b5587b45ac1d7780828db7ec8","user":{"login":"jfinkels","id":121755,"avatar_url":"https://avatars.githubusercontent.com/u/121755?v=3","gravatar_id":"","url":"https://api.github.com/users/jfinkels","html_url":"https://github.com/jfinkels","followers_url":"https://api.github.com/users/jfinkels/followers","following_url":"https://api.github.com/users/jfinkels/following{/other_user}","gists_url":"https://api.github.com/users/jfinkels/gists{/gist_id}","starred_url":"https://api.github.com/users/jfinkels/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jfinkels/subscriptions","organizations_url":"https://api.github.com/users/jfinkels/orgs","repos_url":"https://api.github.com/users/jfinkels/repos","events_url":"https://api.github.com/users/jfinkels/events{/privacy}","received_events_url":"https://api.github.com/users/jfinkels/received_events","type":"User","site_admin":false},"body":"Hanging indent should match initial indent.","created_at":"2015-06-14T04:48:20Z","updated_at":"2015-06-14T04:48:20Z","html_url":"https://github.com/networkx/networkx/pull/1559#discussion_r32376355","pull_request_url":"https://api.github.com/repos/networkx/networkx/pulls/1559","_links":{"self":{"href":"https://api.github.com/repos/networkx/networkx/pulls/comments/32376355"},"html":{"href":"https://github.com/networkx/networkx/pull/1559#discussion_r32376355"},"pull_request":{"href":"https://api.github.com/repos/networkx/networkx/pulls/1559"}}},"pull_request":{"url":"https://api.github.com/repos/networkx/networkx/pulls/1559","id":36807957,"html_url":"https://github.com/networkx/networkx/pull/1559","diff_url":"https://github.com/networkx/networkx/pull/1559.diff","patch_url":"https://github.com/networkx/networkx/pull/1559.patch","issue_url":"https://api.github.com/repos/networkx/networkx/issues/1559","number":1559,"state":"open","locked":false,"title":"Asynchronous Label Propagation Algorithm for community detection","user":{"login":"aitoralmeida","id":2103213,"avatar_url":"https://avatars.githubusercontent.com/u/2103213?v=3","gravatar_id":"","url":"https://api.github.com/users/aitoralmeida","html_url":"https://github.com/aitoralmeida","followers_url":"https://api.github.com/users/aitoralmeida/followers","following_url":"https://api.github.com/users/aitoralmeida/following{/other_user}","gists_url":"https://api.github.com/users/aitoralmeida/gists{/gist_id}","starred_url":"https://api.github.com/users/aitoralmeida/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/aitoralmeida/subscriptions","organizations_url":"https://api.github.com/users/aitoralmeida/orgs","repos_url":"https://api.github.com/users/aitoralmeida/repos","events_url":"https://api.github.com/users/aitoralmeida/events{/privacy}","received_events_url":"https://api.github.com/users/aitoralmeida/received_events","type":"User","site_admin":false},"body":"Asynchronous label propagation algorithm for community detection described in [1]_. The algorithm is non-deterministic and the found communities may vary on different executions. Slightly modified to be able to take into account the weight of the edges when choosing the node labels.\r\n\r\n[1] Raghavan, Usha Nandini, Réka Albert, and Soundar Kumara. \"Near linear time algorithm to detect community structures in large-scale networks.\" Physical Review E 76.3 (2007): 036106.\r\n\r\nEDIT: The difference with the one implemented in #1259 is that this one is asynchronous while the other is semi-synchronous. I will try to add a synchronous algorithm also to have the three options available.","created_at":"2015-06-03T08:16:12Z","updated_at":"2015-06-14T04:48:20Z","closed_at":null,"merged_at":null,"merge_commit_sha":"8c03025bd35b3ace064292db90e822cd92defaaa","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/networkx/networkx/pulls/1559/commits","review_comments_url":"https://api.github.com/repos/networkx/networkx/pulls/1559/comments","review_comment_url":"https://api.github.com/repos/networkx/networkx/pulls/comments{/number}","comments_url":"https://api.github.com/repos/networkx/networkx/issues/1559/comments","statuses_url":"https://api.github.com/repos/networkx/networkx/statuses/e46a998fd9a24c0b5587b45ac1d7780828db7ec8","head":{"label":"aitoralmeida:asyn_lpa","ref":"asyn_lpa","sha":"e46a998fd9a24c0b5587b45ac1d7780828db7ec8","user":{"login":"aitoralmeida","id":2103213,"avatar_url":"https://avatars.githubusercontent.com/u/2103213?v=3","gravatar_id":"","url":"https://api.github.com/users/aitoralmeida","html_url":"https://github.com/aitoralmeida","followers_url":"https://api.github.com/users/aitoralmeida/followers","following_url":"https://api.github.com/users/aitoralmeida/following{/other_user}","gists_url":"https://api.github.com/users/aitoralmeida/gists{/gist_id}","starred_url":"https://api.github.com/users/aitoralmeida/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/aitoralmeida/subscriptions","organizations_url":"https://api.github.com/users/aitoralmeida/orgs","repos_url":"https://api.github.com/users/aitoralmeida/repos","events_url":"https://api.github.com/users/aitoralmeida/events{/privacy}","received_events_url":"https://api.github.com/users/aitoralmeida/received_events","type":"User","site_admin":false},"repo":{"id":24717231,"name":"networkx","full_name":"aitoralmeida/networkx","owner":{"login":"aitoralmeida","id":2103213,"avatar_url":"https://avatars.githubusercontent.com/u/2103213?v=3","gravatar_id":"","url":"https://api.github.com/users/aitoralmeida","html_url":"https://github.com/aitoralmeida","followers_url":"https://api.github.com/users/aitoralmeida/followers","following_url":"https://api.github.com/users/aitoralmeida/following{/other_user}","gists_url":"https://api.github.com/users/aitoralmeida/gists{/gist_id}","starred_url":"https://api.github.com/users/aitoralmeida/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/aitoralmeida/subscriptions","organizations_url":"https://api.github.com/users/aitoralmeida/orgs","repos_url":"https://api.github.com/users/aitoralmeida/repos","events_url":"https://api.github.com/users/aitoralmeida/events{/privacy}","received_events_url":"https://api.github.com/users/aitoralmeida/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/aitoralmeida/networkx","description":"Official NetworkX source code repository.  ","fork":true,"url":"https://api.github.com/repos/aitoralmeida/networkx","forks_url":"https://api.github.com/repos/aitoralmeida/networkx/forks","keys_url":"https://api.github.com/repos/aitoralmeida/networkx/keys{/key_id}","collaborators_url":"https://api.github.com/repos/aitoralmeida/networkx/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/aitoralmeida/networkx/teams","hooks_url":"https://api.github.com/repos/aitoralmeida/networkx/hooks","issue_events_url":"https://api.github.com/repos/aitoralmeida/networkx/issues/events{/number}","events_url":"https://api.github.com/repos/aitoralmeida/networkx/events","assignees_url":"https://api.github.com/repos/aitoralmeida/networkx/assignees{/user}","branches_url":"https://api.github.com/repos/aitoralmeida/networkx/branches{/branch}","tags_url":"https://api.github.com/repos/aitoralmeida/networkx/tags","blobs_url":"https://api.github.com/repos/aitoralmeida/networkx/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/aitoralmeida/networkx/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/aitoralmeida/networkx/git/refs{/sha}","trees_url":"https://api.github.com/repos/aitoralmeida/networkx/git/trees{/sha}","statuses_url":"https://api.github.com/repos/aitoralmeida/networkx/statuses/{sha}","languages_url":"https://api.github.com/repos/aitoralmeida/networkx/languages","stargazers_url":"https://api.github.com/repos/aitoralmeida/networkx/stargazers","contributors_url":"https://api.github.com/repos/aitoralmeida/networkx/contributors","subscribers_url":"https://api.github.com/repos/aitoralmeida/networkx/subscribers","subscription_url":"https://api.github.com/repos/aitoralmeida/networkx/subscription","commits_url":"https://api.github.com/repos/aitoralmeida/networkx/commits{/sha}","git_commits_url":"https://api.github.com/repos/aitoralmeida/networkx/git/commits{/sha}","comments_url":"https://api.github.com/repos/aitoralmeida/networkx/comments{/number}","issue_comment_url":"https://api.github.com/repos/aitoralmeida/networkx/issues/comments{/number}","contents_url":"https://api.github.com/repos/aitoralmeida/networkx/contents/{+path}","compare_url":"https://api.github.com/repos/aitoralmeida/networkx/compare/{base}...{head}","merges_url":"https://api.github.com/repos/aitoralmeida/networkx/merges","archive_url":"https://api.github.com/repos/aitoralmeida/networkx/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/aitoralmeida/networkx/downloads","issues_url":"https://api.github.com/repos/aitoralmeida/networkx/issues{/number}","pulls_url":"https://api.github.com/repos/aitoralmeida/networkx/pulls{/number}","milestones_url":"https://api.github.com/repos/aitoralmeida/networkx/milestones{/number}","notifications_url":"https://api.github.com/repos/aitoralmeida/networkx/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/aitoralmeida/networkx/labels{/name}","releases_url":"https://api.github.com/repos/aitoralmeida/networkx/releases{/id}","created_at":"2014-10-02T12:02:32Z","updated_at":"2014-09-30T05:46:22Z","pushed_at":"2015-06-11T10:12:45Z","git_url":"git://github.com/aitoralmeida/networkx.git","ssh_url":"git@github.com:aitoralmeida/networkx.git","clone_url":"https://github.com/aitoralmeida/networkx.git","svn_url":"https://github.com/aitoralmeida/networkx","homepage":"http://networkx.github.io","size":12282,"stargazers_count":0,"watchers_count":0,"language":null,"has_issues":false,"has_downloads":true,"has_wiki":true,"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":"networkx:master","ref":"master","sha":"7afdcdcb2c4e98a48bc35fd9a195a56487a2ac09","user":{"login":"networkx","id":388785,"avatar_url":"https://avatars.githubusercontent.com/u/388785?v=3","gravatar_id":"","url":"https://api.github.com/users/networkx","html_url":"https://github.com/networkx","followers_url":"https://api.github.com/users/networkx/followers","following_url":"https://api.github.com/users/networkx/following{/other_user}","gists_url":"https://api.github.com/users/networkx/gists{/gist_id}","starred_url":"https://api.github.com/users/networkx/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/networkx/subscriptions","organizations_url":"https://api.github.com/users/networkx/orgs","repos_url":"https://api.github.com/users/networkx/repos","events_url":"https://api.github.com/users/networkx/events{/privacy}","received_events_url":"https://api.github.com/users/networkx/received_events","type":"Organization","site_admin":false},"repo":{"id":890377,"name":"networkx","full_name":"networkx/networkx","owner":{"login":"networkx","id":388785,"avatar_url":"https://avatars.githubusercontent.com/u/388785?v=3","gravatar_id":"","url":"https://api.github.com/users/networkx","html_url":"https://github.com/networkx","followers_url":"https://api.github.com/users/networkx/followers","following_url":"https://api.github.com/users/networkx/following{/other_user}","gists_url":"https://api.github.com/users/networkx/gists{/gist_id}","starred_url":"https://api.github.com/users/networkx/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/networkx/subscriptions","organizations_url":"https://api.github.com/users/networkx/orgs","repos_url":"https://api.github.com/users/networkx/repos","events_url":"https://api.github.com/users/networkx/events{/privacy}","received_events_url":"https://api.github.com/users/networkx/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/networkx/networkx","description":"Official NetworkX source code repository.  ","fork":false,"url":"https://api.github.com/repos/networkx/networkx","forks_url":"https://api.github.com/repos/networkx/networkx/forks","keys_url":"https://api.github.com/repos/networkx/networkx/keys{/key_id}","collaborators_url":"https://api.github.com/repos/networkx/networkx/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/networkx/networkx/teams","hooks_url":"https://api.github.com/repos/networkx/networkx/hooks","issue_events_url":"https://api.github.com/repos/networkx/networkx/issues/events{/number}","events_url":"https://api.github.com/repos/networkx/networkx/events","assignees_url":"https://api.github.com/repos/networkx/networkx/assignees{/user}","branches_url":"https://api.github.com/repos/networkx/networkx/branches{/branch}","tags_url":"https://api.github.com/repos/networkx/networkx/tags","blobs_url":"https://api.github.com/repos/networkx/networkx/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/networkx/networkx/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/networkx/networkx/git/refs{/sha}","trees_url":"https://api.github.com/repos/networkx/networkx/git/trees{/sha}","statuses_url":"https://api.github.com/repos/networkx/networkx/statuses/{sha}","languages_url":"https://api.github.com/repos/networkx/networkx/languages","stargazers_url":"https://api.github.com/repos/networkx/networkx/stargazers","contributors_url":"https://api.github.com/repos/networkx/networkx/contributors","subscribers_url":"https://api.github.com/repos/networkx/networkx/subscribers","subscription_url":"https://api.github.com/repos/networkx/networkx/subscription","commits_url":"https://api.github.com/repos/networkx/networkx/commits{/sha}","git_commits_url":"https://api.github.com/repos/networkx/networkx/git/commits{/sha}","comments_url":"https://api.github.com/repos/networkx/networkx/comments{/number}","issue_comment_url":"https://api.github.com/repos/networkx/networkx/issues/comments{/number}","contents_url":"https://api.github.com/repos/networkx/networkx/contents/{+path}","compare_url":"https://api.github.com/repos/networkx/networkx/compare/{base}...{head}","merges_url":"https://api.github.com/repos/networkx/networkx/merges","archive_url":"https://api.github.com/repos/networkx/networkx/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/networkx/networkx/downloads","issues_url":"https://api.github.com/repos/networkx/networkx/issues{/number}","pulls_url":"https://api.github.com/repos/networkx/networkx/pulls{/number}","milestones_url":"https://api.github.com/repos/networkx/networkx/milestones{/number}","notifications_url":"https://api.github.com/repos/networkx/networkx/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/networkx/networkx/labels{/name}","releases_url":"https://api.github.com/repos/networkx/networkx/releases{/id}","created_at":"2010-09-06T00:53:44Z","updated_at":"2015-06-13T14:42:45Z","pushed_at":"2015-06-13T23:08:27Z","git_url":"git://github.com/networkx/networkx.git","ssh_url":"git@github.com:networkx/networkx.git","clone_url":"https://github.com/networkx/networkx.git","svn_url":"https://github.com/networkx/networkx","homepage":"http://networkx.github.io","size":22335,"stargazers_count":1439,"watchers_count":1439,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":459,"mirror_url":null,"open_issues_count":229,"forks":459,"open_issues":229,"watchers":1439,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/networkx/networkx/pulls/1559"},"html":{"href":"https://github.com/networkx/networkx/pull/1559"},"issue":{"href":"https://api.github.com/repos/networkx/networkx/issues/1559"},"comments":{"href":"https://api.github.com/repos/networkx/networkx/issues/1559/comments"},"review_comments":{"href":"https://api.github.com/repos/networkx/networkx/pulls/1559/comments"},"review_comment":{"href":"https://api.github.com/repos/networkx/networkx/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/networkx/networkx/pulls/1559/commits"},"statuses":{"href":"https://api.github.com/repos/networkx/networkx/statuses/e46a998fd9a24c0b5587b45ac1d7780828db7ec8"}}}}