{"action":"created","issue":{"url":"https://api.github.com/repos/lthurner/pandapower/issues/127","repository_url":"https://api.github.com/repos/lthurner/pandapower","labels_url":"https://api.github.com/repos/lthurner/pandapower/issues/127/labels{/name}","comments_url":"https://api.github.com/repos/lthurner/pandapower/issues/127/comments","events_url":"https://api.github.com/repos/lthurner/pandapower/issues/127/events","html_url":"https://github.com/lthurner/pandapower/pull/127","id":339938751,"node_id":"MDExOlB1bGxSZXF1ZXN0MjAwNDcwNjQ4","number":127,"title":"Faster graph creation","user":{"login":"WinfriedL","id":37797648,"node_id":"MDQ6VXNlcjM3Nzk3NjQ4","avatar_url":"https://avatars1.githubusercontent.com/u/37797648?v=4","gravatar_id":"","url":"https://api.github.com/users/WinfriedL","html_url":"https://github.com/WinfriedL","followers_url":"https://api.github.com/users/WinfriedL/followers","following_url":"https://api.github.com/users/WinfriedL/following{/other_user}","gists_url":"https://api.github.com/users/WinfriedL/gists{/gist_id}","starred_url":"https://api.github.com/users/WinfriedL/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/WinfriedL/subscriptions","organizations_url":"https://api.github.com/users/WinfriedL/orgs","repos_url":"https://api.github.com/users/WinfriedL/repos","events_url":"https://api.github.com/users/WinfriedL/events{/privacy}","received_events_url":"https://api.github.com/users/WinfriedL/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":1,"created_at":"2018-07-10T17:30:20Z","updated_at":"2018-07-12T08:11:56Z","closed_at":null,"author_association":"CONTRIBUTOR","pull_request":{"url":"https://api.github.com/repos/lthurner/pandapower/pulls/127","html_url":"https://github.com/lthurner/pandapower/pull/127","diff_url":"https://github.com/lthurner/pandapower/pull/127.diff","patch_url":"https://github.com/lthurner/pandapower/pull/127.patch"},"body":"I changed the implementation for the `create_graph()` function to iterate over the dataframes and add single edges for each branch. On my machine and testcase this speeds up the graph creation from about 110ms to 90ms and has in my opinion some other advantages:\r\n- The code is more readable\r\n- More flexible to add/change weights\r\n- Easier to make it configurable\r\n\r\nI believe the reason for the speed improvement is that networkx `add_edges_from()` more or less only iterates over the list of edges and calls `add_egde()` with the appropriate parameters. So instead of creating lists of edges with complex zip() calls only to iterate over it anyway can be replaced by iterating over the dataframes and call `add_edge()` directly.\r\n\r\nHowever, before thinking about merging this, there probably should be a decision about #85, as you can see by acd4d3cf48fcd04f342265c1ccc9a7fb8e6bfb88"},"comment":{"url":"https://api.github.com/repos/lthurner/pandapower/issues/comments/404428123","html_url":"https://github.com/lthurner/pandapower/pull/127#issuecomment-404428123","issue_url":"https://api.github.com/repos/lthurner/pandapower/issues/127","id":404428123,"node_id":"MDEyOklzc3VlQ29tbWVudDQwNDQyODEyMw==","user":{"login":"lthurner","id":23637821,"node_id":"MDQ6VXNlcjIzNjM3ODIx","avatar_url":"https://avatars1.githubusercontent.com/u/23637821?v=4","gravatar_id":"","url":"https://api.github.com/users/lthurner","html_url":"https://github.com/lthurner","followers_url":"https://api.github.com/users/lthurner/followers","following_url":"https://api.github.com/users/lthurner/following{/other_user}","gists_url":"https://api.github.com/users/lthurner/gists{/gist_id}","starred_url":"https://api.github.com/users/lthurner/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/lthurner/subscriptions","organizations_url":"https://api.github.com/users/lthurner/orgs","repos_url":"https://api.github.com/users/lthurner/repos","events_url":"https://api.github.com/users/lthurner/events{/privacy}","received_events_url":"https://api.github.com/users/lthurner/received_events","type":"User","site_admin":false},"created_at":"2018-07-12T08:11:56Z","updated_at":"2018-07-12T08:11:56Z","author_association":"OWNER","body":"This issue is further complicated by the fact that networkx 1.x and 2.x have some significant differences in the internal data structure with regard to the attributes. We have tried to write the code so that it is compatible with both versions, but maybe we should ditch 1.x support and just switch to 2.x.\r\n\r\nAlso all tests are passing, but I am not sure how good the test suite for the graph creation functions are? We should also check that before refactoring..."}}
{"actor":{"display_login":"lthurner"}}