{"action":"created","comment":{"url":"https://api.github.com/repos/networkx/networkx/pulls/comments/28000523","id":28000523,"diff_hunk":"@@ -0,0 +1,75 @@\n+\"\"\"Modularity matrix of graphs.\n+\"\"\"\n+#    Copyright (C) 2004-2015 by\n+#    Aric Hagberg <hagberg@lanl.gov>\n+#    Dan Schult <dschult@colgate.edu>\n+#    Pieter Swart <swart@lanl.gov>\n+#    All rights reserved.\n+#    BSD license.\n+from __future__ import division\n+import networkx as nx\n+from networkx.utils import not_implemented_for\n+\n+__author__ = \"\\n\".join(['Aric Hagberg <aric.hagberg@gmail.com>',\n+                        'Pieter Swart (swart@lanl.gov)',\n+                        'Dan Schult (dschult@colgate.edu)',\n+                        'Jean-Gabriel Young <jean.gabriel.young@gmail.com>'])\n+__all__ = ['modularity_matrix']\n+\n+\n+@not_implemented_for('directed')\n+@not_implemented_for('multigraph')\n+def modularity_matrix(G, nodelist=None):\n+    \"\"\"Return the modularity matrix of G.\n+\n+    The modularity matrix is the matrix B = A - <A>, where A is the adjacency\n+    matrix and <A> is the average adjacency matrix, assuming that the graph\n+    is descibred by the configuration model.\n+\n+    Parameters\n+    ----------\n+    G : graph\n+       A NetworkX graph\n+\n+    nodelist : list, optional\n+       The rows and columns are ordered according to the nodes in nodelist.\n+       If nodelist is None, then the ordering is produced by G.nodes().\n+\n+    Returns\n+    -------\n+    B : Numpy matrix\n+      The modularity matrix of G.\n+\n+    Notes\n+    -----\n+    For MultiGraph/MultiDiGraph, the edges weights are summed.","path":"networkx/linalg/modularitymatrix.py","position":null,"original_position":45,"commit_id":"46920676f1564bbfc433d2117a91109c007409e4","original_commit_id":"89711442dc5397ec2f76ea81fdc28d93a138757d","user":{"login":"jg-you","id":6925003,"avatar_url":"https://avatars.githubusercontent.com/u/6925003?v=3","gravatar_id":"","url":"https://api.github.com/users/jg-you","html_url":"https://github.com/jg-you","followers_url":"https://api.github.com/users/jg-you/followers","following_url":"https://api.github.com/users/jg-you/following{/other_user}","gists_url":"https://api.github.com/users/jg-you/gists{/gist_id}","starred_url":"https://api.github.com/users/jg-you/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jg-you/subscriptions","organizations_url":"https://api.github.com/users/jg-you/orgs","repos_url":"https://api.github.com/users/jg-you/repos","events_url":"https://api.github.com/users/jg-you/events{/privacy}","received_events_url":"https://api.github.com/users/jg-you/received_events","type":"User","site_admin":false},"body":"Oops, it slipped through (I used `linealg/laplacianmatrix.py` as a base template)\r\nMy apologies. ","created_at":"2015-04-08T18:45:40Z","updated_at":"2015-04-08T18:45:40Z","html_url":"https://github.com/networkx/networkx/pull/1448#discussion_r28000523","pull_request_url":"https://api.github.com/repos/networkx/networkx/pulls/1448","_links":{"self":{"href":"https://api.github.com/repos/networkx/networkx/pulls/comments/28000523"},"html":{"href":"https://github.com/networkx/networkx/pull/1448#discussion_r28000523"},"pull_request":{"href":"https://api.github.com/repos/networkx/networkx/pulls/1448"}}},"pull_request":{"url":"https://api.github.com/repos/networkx/networkx/pulls/1448","id":32877089,"html_url":"https://github.com/networkx/networkx/pull/1448","diff_url":"https://github.com/networkx/networkx/pull/1448.diff","patch_url":"https://github.com/networkx/networkx/pull/1448.patch","issue_url":"https://api.github.com/repos/networkx/networkx/issues/1448","number":1448,"state":"open","locked":false,"title":"Modularity matrix","user":{"login":"jg-you","id":6925003,"avatar_url":"https://avatars.githubusercontent.com/u/6925003?v=3","gravatar_id":"","url":"https://api.github.com/users/jg-you","html_url":"https://github.com/jg-you","followers_url":"https://api.github.com/users/jg-you/followers","following_url":"https://api.github.com/users/jg-you/following{/other_user}","gists_url":"https://api.github.com/users/jg-you/gists{/gist_id}","starred_url":"https://api.github.com/users/jg-you/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jg-you/subscriptions","organizations_url":"https://api.github.com/users/jg-you/orgs","repos_url":"https://api.github.com/users/jg-you/repos","events_url":"https://api.github.com/users/jg-you/events{/privacy}","received_events_url":"https://api.github.com/users/jg-you/received_events","type":"User","site_admin":false},"body":"This pull request implements the modularity matrix (MEJ Newman, 2006, PNAS) with associated test suites and spectrum operations.\r\nI did not implement any weighted/multigraph/directed methods since there is no consensus on the definition, to the best of my knowledge.\r\n\r\nThis is my first contribution to NetworkX, comments are more than welcome.","created_at":"2015-04-08T16:22:34Z","updated_at":"2015-04-08T18:45:40Z","closed_at":null,"merged_at":null,"merge_commit_sha":"a69db892cbedb4fd59763ca4057136426d532fed","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/networkx/networkx/pulls/1448/commits","review_comments_url":"https://api.github.com/repos/networkx/networkx/pulls/1448/comments","review_comment_url":"https://api.github.com/repos/networkx/networkx/pulls/comments{/number}","comments_url":"https://api.github.com/repos/networkx/networkx/issues/1448/comments","statuses_url":"https://api.github.com/repos/networkx/networkx/statuses/46920676f1564bbfc433d2117a91109c007409e4","head":{"label":"jg-you:modularity-matrix","ref":"modularity-matrix","sha":"46920676f1564bbfc433d2117a91109c007409e4","user":{"login":"jg-you","id":6925003,"avatar_url":"https://avatars.githubusercontent.com/u/6925003?v=3","gravatar_id":"","url":"https://api.github.com/users/jg-you","html_url":"https://github.com/jg-you","followers_url":"https://api.github.com/users/jg-you/followers","following_url":"https://api.github.com/users/jg-you/following{/other_user}","gists_url":"https://api.github.com/users/jg-you/gists{/gist_id}","starred_url":"https://api.github.com/users/jg-you/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jg-you/subscriptions","organizations_url":"https://api.github.com/users/jg-you/orgs","repos_url":"https://api.github.com/users/jg-you/repos","events_url":"https://api.github.com/users/jg-you/events{/privacy}","received_events_url":"https://api.github.com/users/jg-you/received_events","type":"User","site_admin":false},"repo":{"id":33611912,"name":"networkx","full_name":"jg-you/networkx","owner":{"login":"jg-you","id":6925003,"avatar_url":"https://avatars.githubusercontent.com/u/6925003?v=3","gravatar_id":"","url":"https://api.github.com/users/jg-you","html_url":"https://github.com/jg-you","followers_url":"https://api.github.com/users/jg-you/followers","following_url":"https://api.github.com/users/jg-you/following{/other_user}","gists_url":"https://api.github.com/users/jg-you/gists{/gist_id}","starred_url":"https://api.github.com/users/jg-you/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jg-you/subscriptions","organizations_url":"https://api.github.com/users/jg-you/orgs","repos_url":"https://api.github.com/users/jg-you/repos","events_url":"https://api.github.com/users/jg-you/events{/privacy}","received_events_url":"https://api.github.com/users/jg-you/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/jg-you/networkx","description":"Official NetworkX source code repository.  ","fork":true,"url":"https://api.github.com/repos/jg-you/networkx","forks_url":"https://api.github.com/repos/jg-you/networkx/forks","keys_url":"https://api.github.com/repos/jg-you/networkx/keys{/key_id}","collaborators_url":"https://api.github.com/repos/jg-you/networkx/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/jg-you/networkx/teams","hooks_url":"https://api.github.com/repos/jg-you/networkx/hooks","issue_events_url":"https://api.github.com/repos/jg-you/networkx/issues/events{/number}","events_url":"https://api.github.com/repos/jg-you/networkx/events","assignees_url":"https://api.github.com/repos/jg-you/networkx/assignees{/user}","branches_url":"https://api.github.com/repos/jg-you/networkx/branches{/branch}","tags_url":"https://api.github.com/repos/jg-you/networkx/tags","blobs_url":"https://api.github.com/repos/jg-you/networkx/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/jg-you/networkx/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/jg-you/networkx/git/refs{/sha}","trees_url":"https://api.github.com/repos/jg-you/networkx/git/trees{/sha}","statuses_url":"https://api.github.com/repos/jg-you/networkx/statuses/{sha}","languages_url":"https://api.github.com/repos/jg-you/networkx/languages","stargazers_url":"https://api.github.com/repos/jg-you/networkx/stargazers","contributors_url":"https://api.github.com/repos/jg-you/networkx/contributors","subscribers_url":"https://api.github.com/repos/jg-you/networkx/subscribers","subscription_url":"https://api.github.com/repos/jg-you/networkx/subscription","commits_url":"https://api.github.com/repos/jg-you/networkx/commits{/sha}","git_commits_url":"https://api.github.com/repos/jg-you/networkx/git/commits{/sha}","comments_url":"https://api.github.com/repos/jg-you/networkx/comments{/number}","issue_comment_url":"https://api.github.com/repos/jg-you/networkx/issues/comments{/number}","contents_url":"https://api.github.com/repos/jg-you/networkx/contents/{+path}","compare_url":"https://api.github.com/repos/jg-you/networkx/compare/{base}...{head}","merges_url":"https://api.github.com/repos/jg-you/networkx/merges","archive_url":"https://api.github.com/repos/jg-you/networkx/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/jg-you/networkx/downloads","issues_url":"https://api.github.com/repos/jg-you/networkx/issues{/number}","pulls_url":"https://api.github.com/repos/jg-you/networkx/pulls{/number}","milestones_url":"https://api.github.com/repos/jg-you/networkx/milestones{/number}","notifications_url":"https://api.github.com/repos/jg-you/networkx/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/jg-you/networkx/labels{/name}","releases_url":"https://api.github.com/repos/jg-you/networkx/releases{/id}","created_at":"2015-04-08T14:28:04Z","updated_at":"2015-04-08T14:28:06Z","pushed_at":"2015-04-08T18:45:33Z","git_url":"git://github.com/jg-you/networkx.git","ssh_url":"git@github.com:jg-you/networkx.git","clone_url":"https://github.com/jg-you/networkx.git","svn_url":"https://github.com/jg-you/networkx","homepage":"http://networkx.github.io","size":21128,"stargazers_count":0,"watchers_count":0,"language":"Python","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":"6841acb738d18db45557b7b97506ecd3e3bb9345","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-04-08T03:52:59Z","pushed_at":"2015-04-08T18:45:34Z","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":21128,"stargazers_count":1321,"watchers_count":1321,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":417,"mirror_url":null,"open_issues_count":184,"forks":417,"open_issues":184,"watchers":1321,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/networkx/networkx/pulls/1448"},"html":{"href":"https://github.com/networkx/networkx/pull/1448"},"issue":{"href":"https://api.github.com/repos/networkx/networkx/issues/1448"},"comments":{"href":"https://api.github.com/repos/networkx/networkx/issues/1448/comments"},"review_comments":{"href":"https://api.github.com/repos/networkx/networkx/pulls/1448/comments"},"review_comment":{"href":"https://api.github.com/repos/networkx/networkx/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/networkx/networkx/pulls/1448/commits"},"statuses":{"href":"https://api.github.com/repos/networkx/networkx/statuses/46920676f1564bbfc433d2117a91109c007409e4"}}}}