{"action":"created","issue":{"url":"https://api.github.com/repos/networkx/networkx/issues/1379","labels_url":"https://api.github.com/repos/networkx/networkx/issues/1379/labels{/name}","comments_url":"https://api.github.com/repos/networkx/networkx/issues/1379/comments","events_url":"https://api.github.com/repos/networkx/networkx/issues/1379/events","html_url":"https://github.com/networkx/networkx/pull/1379","id":59549698,"number":1379,"title":"Refactor complete_bipartite_graph. Fixes #1375.","user":{"login":"jtorrents","id":1184374,"avatar_url":"https://avatars.githubusercontent.com/u/1184374?v=3","gravatar_id":"","url":"https://api.github.com/users/jtorrents","html_url":"https://github.com/jtorrents","followers_url":"https://api.github.com/users/jtorrents/followers","following_url":"https://api.github.com/users/jtorrents/following{/other_user}","gists_url":"https://api.github.com/users/jtorrents/gists{/gist_id}","starred_url":"https://api.github.com/users/jtorrents/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jtorrents/subscriptions","organizations_url":"https://api.github.com/users/jtorrents/orgs","repos_url":"https://api.github.com/users/jtorrents/repos","events_url":"https://api.github.com/users/jtorrents/events{/privacy}","received_events_url":"https://api.github.com/users/jtorrents/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/networkx/networkx/labels/Defect","name":"Defect","color":"e11d21"}],"state":"closed","locked":false,"assignee":null,"milestone":{"url":"https://api.github.com/repos/networkx/networkx/milestones/3","html_url":"https://github.com/networkx/networkx/milestones/networkx-2.0","labels_url":"https://api.github.com/repos/networkx/networkx/milestones/3/labels","id":236124,"number":3,"title":"networkx-2.0","description":"","creator":{"login":"hagberg","id":187875,"avatar_url":"https://avatars.githubusercontent.com/u/187875?v=3","gravatar_id":"","url":"https://api.github.com/users/hagberg","html_url":"https://github.com/hagberg","followers_url":"https://api.github.com/users/hagberg/followers","following_url":"https://api.github.com/users/hagberg/following{/other_user}","gists_url":"https://api.github.com/users/hagberg/gists{/gist_id}","starred_url":"https://api.github.com/users/hagberg/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hagberg/subscriptions","organizations_url":"https://api.github.com/users/hagberg/orgs","repos_url":"https://api.github.com/users/hagberg/repos","events_url":"https://api.github.com/users/hagberg/events{/privacy}","received_events_url":"https://api.github.com/users/hagberg/received_events","type":"User","site_admin":false},"open_issues":30,"closed_issues":84,"state":"open","created_at":"2012-12-29T15:43:08Z","updated_at":"2015-03-02T21:58:48Z","due_on":"2015-07-01T07:00:00Z","closed_at":null},"comments":4,"created_at":"2015-03-02T21:01:54Z","updated_at":"2015-03-03T16:02:57Z","closed_at":"2015-03-02T21:58:46Z","pull_request":{"url":"https://api.github.com/repos/networkx/networkx/pulls/1379","html_url":"https://github.com/networkx/networkx/pull/1379","diff_url":"https://github.com/networkx/networkx/pull/1379.diff","patch_url":"https://github.com/networkx/networkx/pull/1379.patch"},"body":"This commit reimplements `complete_bipartite_graph` using a generator\r\nexpression instead of two nested for loops. Also adds the `bipartite`\r\nnode attribute (that was missing, as per #1375).\r\n\r\nI've also moved the `complete_bipartite_graph` function from `classic.py`\r\nto `bipartite.py`. I think it's better to have all bipartite generators\r\ntogether.\r\n\r\nThe function `complete_bipartite_graph` is used by other functions, such as\r\n`wheel_graph`, which was abusing the interface by passing -1 as the second\r\nargument of `complete_bipartite_graph` (for `wheel_graph(0)`) and hoping to\r\nget an empty graph with zero nodes. This is also fixed."},"comment":{"url":"https://api.github.com/repos/networkx/networkx/issues/comments/76973998","html_url":"https://github.com/networkx/networkx/pull/1379#issuecomment-76973998","issue_url":"https://api.github.com/repos/networkx/networkx/issues/1379","id":76973998,"user":{"login":"MassimoLauria","id":98795,"avatar_url":"https://avatars.githubusercontent.com/u/98795?v=3","gravatar_id":"","url":"https://api.github.com/users/MassimoLauria","html_url":"https://github.com/MassimoLauria","followers_url":"https://api.github.com/users/MassimoLauria/followers","following_url":"https://api.github.com/users/MassimoLauria/following{/other_user}","gists_url":"https://api.github.com/users/MassimoLauria/gists{/gist_id}","starred_url":"https://api.github.com/users/MassimoLauria/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/MassimoLauria/subscriptions","organizations_url":"https://api.github.com/users/MassimoLauria/orgs","repos_url":"https://api.github.com/users/MassimoLauria/repos","events_url":"https://api.github.com/users/MassimoLauria/events{/privacy}","received_events_url":"https://api.github.com/users/MassimoLauria/received_events","type":"User","site_admin":false},"created_at":"2015-03-03T16:02:57Z","updated_at":"2015-03-03T16:02:57Z","body":"There is a problem with this patch: for consistency with the other bipartite constructions\r\nthe vertices [0,n1) should have attribute `bipartite=0` and the vertices [n1,n1+n2) should have attribute `bipartite=1`. \r\n\r\nThe way it is in this new path is inconsistent. This is particularly problematic since constructions as `bipartite_random_graph(n,m,p)` fallback to `complete_bipartite_graph(n,m)` for `p=1` which results as a sudden flip of the `bipartite` attribute.\r\n\r\nFurthermore: wouldn't be better to rename `complete_bipartite_graph` to `bipartite_complete_graph` for consistency, and maybe keep the old name as an alias?"}}