{"action":"created","comment":{"url":"https://api.github.com/repos/greenelab/hetmech/pulls/comments/190637783","pull_request_review_id":123055793,"id":190637783,"diff_hunk":"@@ -368,6 +368,75 @@ def add_head_tail(metapath, indices):\n     return segments\n \n \n+def get_all_segments(metagraph, metapath):\n+    \"\"\"\n+    Return all subsegments of a given metapath, including those segments that\n+    appear only after early splits.\n+\n+    Parameters\n+    ----------\n+    metagraph : hetio.hetnet.MetaGraph\n+    metapath : hetio.hetnet.MetaPath\n+\n+    Returns\n+    -------\n+    list\n+\n+    Example\n+    -------\n+    >>> get_all_segments(metagraph, CrCbGaDrDaG)\n+    [CrC, CbG, GaDrDaG, GaD, DrD, DaG]\n+    \"\"\"\n+    segments = get_segments(metagraph, metapath)\n+    if len(segments) == 1:\n+        return [metapath]\n+    else:","path":"hetmech/degree_weight.py","position":26,"original_position":26,"commit_id":"c055e6829f0db234c83f0c89faeaacf126e6a494","original_commit_id":"c055e6829f0db234c83f0c89faeaacf126e6a494","user":{"login":"dhimmel","id":1117703,"avatar_url":"https://avatars1.githubusercontent.com/u/1117703?v=4","gravatar_id":"","url":"https://api.github.com/users/dhimmel","html_url":"https://github.com/dhimmel","followers_url":"https://api.github.com/users/dhimmel/followers","following_url":"https://api.github.com/users/dhimmel/following{/other_user}","gists_url":"https://api.github.com/users/dhimmel/gists{/gist_id}","starred_url":"https://api.github.com/users/dhimmel/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dhimmel/subscriptions","organizations_url":"https://api.github.com/users/dhimmel/orgs","repos_url":"https://api.github.com/users/dhimmel/repos","events_url":"https://api.github.com/users/dhimmel/events{/privacy}","received_events_url":"https://api.github.com/users/dhimmel/received_events","type":"User","site_admin":false},"body":"this else can be zapped as return shortcircuits","created_at":"2018-05-24T15:47:10Z","updated_at":"2018-05-24T15:50:23Z","html_url":"https://github.com/greenelab/hetmech/pull/109#discussion_r190637783","pull_request_url":"https://api.github.com/repos/greenelab/hetmech/pulls/109","author_association":"MEMBER","_links":{"self":{"href":"https://api.github.com/repos/greenelab/hetmech/pulls/comments/190637783"},"html":{"href":"https://github.com/greenelab/hetmech/pull/109#discussion_r190637783"},"pull_request":{"href":"https://api.github.com/repos/greenelab/hetmech/pulls/109"}}},"pull_request":{"url":"https://api.github.com/repos/greenelab/hetmech/pulls/109","id":190323399,"html_url":"https://github.com/greenelab/hetmech/pull/109","diff_url":"https://github.com/greenelab/hetmech/pull/109.diff","patch_url":"https://github.com/greenelab/hetmech/pull/109.patch","issue_url":"https://api.github.com/repos/greenelab/hetmech/issues/109","number":109,"state":"open","locked":false,"title":"Prioritize segments for caching","user":{"login":"zietzm","id":7230303,"avatar_url":"https://avatars1.githubusercontent.com/u/7230303?v=4","gravatar_id":"","url":"https://api.github.com/users/zietzm","html_url":"https://github.com/zietzm","followers_url":"https://api.github.com/users/zietzm/followers","following_url":"https://api.github.com/users/zietzm/following{/other_user}","gists_url":"https://api.github.com/users/zietzm/gists{/gist_id}","starred_url":"https://api.github.com/users/zietzm/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/zietzm/subscriptions","organizations_url":"https://api.github.com/users/zietzm/orgs","repos_url":"https://api.github.com/users/zietzm/repos","events_url":"https://api.github.com/users/zietzm/events{/privacy}","received_events_url":"https://api.github.com/users/zietzm/received_events","type":"User","site_admin":false},"body":"Relevant to #108 \r\n\r\nWhen doing bulk computations of DWPC, we want to cache the metapath segments that occur most frequently. To find these, we use two new functions, `get_all_segments` and `order_segments`.\r\n\r\n`get_all_segments` returns a list of all segments that will be found from continued metapath splitting (to completion). An important note here is that I decided keeping segments from each split would be best. For example, given the following metapath: `CrCbGaDrDaG`, we could have gotten all segments in two ways.\r\n\r\nRather than returning:\r\n[`CrC`, `CbG`, `GaD`, `DrD`, `DaG`],\r\n\r\nI think it is more helpful to return\r\n[`CrC`, `CbG`, `GaD`, `DrD`, `DaG`, `GaDrDaG`].\r\n\r\nThis way, if the added segment appears very frequently over all the metapaths for which we want to compute DWPC, then we would prefer to cache the larger segment itself rather than only the smallest units. This way of splitting allows us to make these decisions automatically.","created_at":"2018-05-24T15:06:46Z","updated_at":"2018-05-24T15:50:23Z","closed_at":null,"merged_at":null,"merge_commit_sha":"bfb60834522f6f3e32d6e8a00e5a366a27162004","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/greenelab/hetmech/pulls/109/commits","review_comments_url":"https://api.github.com/repos/greenelab/hetmech/pulls/109/comments","review_comment_url":"https://api.github.com/repos/greenelab/hetmech/pulls/comments{/number}","comments_url":"https://api.github.com/repos/greenelab/hetmech/issues/109/comments","statuses_url":"https://api.github.com/repos/greenelab/hetmech/statuses/c055e6829f0db234c83f0c89faeaacf126e6a494","head":{"label":"zietzm:segments-cache","ref":"segments-cache","sha":"c055e6829f0db234c83f0c89faeaacf126e6a494","user":{"login":"zietzm","id":7230303,"avatar_url":"https://avatars1.githubusercontent.com/u/7230303?v=4","gravatar_id":"","url":"https://api.github.com/users/zietzm","html_url":"https://github.com/zietzm","followers_url":"https://api.github.com/users/zietzm/followers","following_url":"https://api.github.com/users/zietzm/following{/other_user}","gists_url":"https://api.github.com/users/zietzm/gists{/gist_id}","starred_url":"https://api.github.com/users/zietzm/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/zietzm/subscriptions","organizations_url":"https://api.github.com/users/zietzm/orgs","repos_url":"https://api.github.com/users/zietzm/repos","events_url":"https://api.github.com/users/zietzm/events{/privacy}","received_events_url":"https://api.github.com/users/zietzm/received_events","type":"User","site_admin":false},"repo":{"id":88914097,"name":"hetmech","full_name":"zietzm/hetmech","owner":{"login":"zietzm","id":7230303,"avatar_url":"https://avatars1.githubusercontent.com/u/7230303?v=4","gravatar_id":"","url":"https://api.github.com/users/zietzm","html_url":"https://github.com/zietzm","followers_url":"https://api.github.com/users/zietzm/followers","following_url":"https://api.github.com/users/zietzm/following{/other_user}","gists_url":"https://api.github.com/users/zietzm/gists{/gist_id}","starred_url":"https://api.github.com/users/zietzm/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/zietzm/subscriptions","organizations_url":"https://api.github.com/users/zietzm/orgs","repos_url":"https://api.github.com/users/zietzm/repos","events_url":"https://api.github.com/users/zietzm/events{/privacy}","received_events_url":"https://api.github.com/users/zietzm/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/zietzm/hetmech","description":"Greene Lab/Theory In Practice collaboration on identifying mechanisms using hetnets","fork":true,"url":"https://api.github.com/repos/zietzm/hetmech","forks_url":"https://api.github.com/repos/zietzm/hetmech/forks","keys_url":"https://api.github.com/repos/zietzm/hetmech/keys{/key_id}","collaborators_url":"https://api.github.com/repos/zietzm/hetmech/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/zietzm/hetmech/teams","hooks_url":"https://api.github.com/repos/zietzm/hetmech/hooks","issue_events_url":"https://api.github.com/repos/zietzm/hetmech/issues/events{/number}","events_url":"https://api.github.com/repos/zietzm/hetmech/events","assignees_url":"https://api.github.com/repos/zietzm/hetmech/assignees{/user}","branches_url":"https://api.github.com/repos/zietzm/hetmech/branches{/branch}","tags_url":"https://api.github.com/repos/zietzm/hetmech/tags","blobs_url":"https://api.github.com/repos/zietzm/hetmech/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/zietzm/hetmech/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/zietzm/hetmech/git/refs{/sha}","trees_url":"https://api.github.com/repos/zietzm/hetmech/git/trees{/sha}","statuses_url":"https://api.github.com/repos/zietzm/hetmech/statuses/{sha}","languages_url":"https://api.github.com/repos/zietzm/hetmech/languages","stargazers_url":"https://api.github.com/repos/zietzm/hetmech/stargazers","contributors_url":"https://api.github.com/repos/zietzm/hetmech/contributors","subscribers_url":"https://api.github.com/repos/zietzm/hetmech/subscribers","subscription_url":"https://api.github.com/repos/zietzm/hetmech/subscription","commits_url":"https://api.github.com/repos/zietzm/hetmech/commits{/sha}","git_commits_url":"https://api.github.com/repos/zietzm/hetmech/git/commits{/sha}","comments_url":"https://api.github.com/repos/zietzm/hetmech/comments{/number}","issue_comment_url":"https://api.github.com/repos/zietzm/hetmech/issues/comments{/number}","contents_url":"https://api.github.com/repos/zietzm/hetmech/contents/{+path}","compare_url":"https://api.github.com/repos/zietzm/hetmech/compare/{base}...{head}","merges_url":"https://api.github.com/repos/zietzm/hetmech/merges","archive_url":"https://api.github.com/repos/zietzm/hetmech/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/zietzm/hetmech/downloads","issues_url":"https://api.github.com/repos/zietzm/hetmech/issues{/number}","pulls_url":"https://api.github.com/repos/zietzm/hetmech/pulls{/number}","milestones_url":"https://api.github.com/repos/zietzm/hetmech/milestones{/number}","notifications_url":"https://api.github.com/repos/zietzm/hetmech/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/zietzm/hetmech/labels{/name}","releases_url":"https://api.github.com/repos/zietzm/hetmech/releases{/id}","deployments_url":"https://api.github.com/repos/zietzm/hetmech/deployments","created_at":"2017-04-20T21:59:28Z","updated_at":"2018-05-24T15:03:54Z","pushed_at":"2018-05-24T15:19:48Z","git_url":"git://github.com/zietzm/hetmech.git","ssh_url":"git@github.com:zietzm/hetmech.git","clone_url":"https://github.com/zietzm/hetmech.git","svn_url":"https://github.com/zietzm/hetmech","homepage":"","size":10440,"stargazers_count":0,"watchers_count":0,"language":"Jupyter Notebook","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":0,"license":{"key":"other","name":"Other","spdx_id":null,"url":null},"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"greenelab:master","ref":"master","sha":"00bce3d1ddb8d7624e0a180ecb52c69a73976e04","user":{"login":"greenelab","id":9607754,"avatar_url":"https://avatars1.githubusercontent.com/u/9607754?v=4","gravatar_id":"","url":"https://api.github.com/users/greenelab","html_url":"https://github.com/greenelab","followers_url":"https://api.github.com/users/greenelab/followers","following_url":"https://api.github.com/users/greenelab/following{/other_user}","gists_url":"https://api.github.com/users/greenelab/gists{/gist_id}","starred_url":"https://api.github.com/users/greenelab/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/greenelab/subscriptions","organizations_url":"https://api.github.com/users/greenelab/orgs","repos_url":"https://api.github.com/users/greenelab/repos","events_url":"https://api.github.com/users/greenelab/events{/privacy}","received_events_url":"https://api.github.com/users/greenelab/received_events","type":"Organization","site_admin":false},"repo":{"id":63903430,"name":"hetmech","full_name":"greenelab/hetmech","owner":{"login":"greenelab","id":9607754,"avatar_url":"https://avatars1.githubusercontent.com/u/9607754?v=4","gravatar_id":"","url":"https://api.github.com/users/greenelab","html_url":"https://github.com/greenelab","followers_url":"https://api.github.com/users/greenelab/followers","following_url":"https://api.github.com/users/greenelab/following{/other_user}","gists_url":"https://api.github.com/users/greenelab/gists{/gist_id}","starred_url":"https://api.github.com/users/greenelab/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/greenelab/subscriptions","organizations_url":"https://api.github.com/users/greenelab/orgs","repos_url":"https://api.github.com/users/greenelab/repos","events_url":"https://api.github.com/users/greenelab/events{/privacy}","received_events_url":"https://api.github.com/users/greenelab/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/greenelab/hetmech","description":"A search engine for hetnets. Matrix implementations of path-count-based measures","fork":false,"url":"https://api.github.com/repos/greenelab/hetmech","forks_url":"https://api.github.com/repos/greenelab/hetmech/forks","keys_url":"https://api.github.com/repos/greenelab/hetmech/keys{/key_id}","collaborators_url":"https://api.github.com/repos/greenelab/hetmech/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/greenelab/hetmech/teams","hooks_url":"https://api.github.com/repos/greenelab/hetmech/hooks","issue_events_url":"https://api.github.com/repos/greenelab/hetmech/issues/events{/number}","events_url":"https://api.github.com/repos/greenelab/hetmech/events","assignees_url":"https://api.github.com/repos/greenelab/hetmech/assignees{/user}","branches_url":"https://api.github.com/repos/greenelab/hetmech/branches{/branch}","tags_url":"https://api.github.com/repos/greenelab/hetmech/tags","blobs_url":"https://api.github.com/repos/greenelab/hetmech/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/greenelab/hetmech/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/greenelab/hetmech/git/refs{/sha}","trees_url":"https://api.github.com/repos/greenelab/hetmech/git/trees{/sha}","statuses_url":"https://api.github.com/repos/greenelab/hetmech/statuses/{sha}","languages_url":"https://api.github.com/repos/greenelab/hetmech/languages","stargazers_url":"https://api.github.com/repos/greenelab/hetmech/stargazers","contributors_url":"https://api.github.com/repos/greenelab/hetmech/contributors","subscribers_url":"https://api.github.com/repos/greenelab/hetmech/subscribers","subscription_url":"https://api.github.com/repos/greenelab/hetmech/subscription","commits_url":"https://api.github.com/repos/greenelab/hetmech/commits{/sha}","git_commits_url":"https://api.github.com/repos/greenelab/hetmech/git/commits{/sha}","comments_url":"https://api.github.com/repos/greenelab/hetmech/comments{/number}","issue_comment_url":"https://api.github.com/repos/greenelab/hetmech/issues/comments{/number}","contents_url":"https://api.github.com/repos/greenelab/hetmech/contents/{+path}","compare_url":"https://api.github.com/repos/greenelab/hetmech/compare/{base}...{head}","merges_url":"https://api.github.com/repos/greenelab/hetmech/merges","archive_url":"https://api.github.com/repos/greenelab/hetmech/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/greenelab/hetmech/downloads","issues_url":"https://api.github.com/repos/greenelab/hetmech/issues{/number}","pulls_url":"https://api.github.com/repos/greenelab/hetmech/pulls{/number}","milestones_url":"https://api.github.com/repos/greenelab/hetmech/milestones{/number}","notifications_url":"https://api.github.com/repos/greenelab/hetmech/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/greenelab/hetmech/labels{/name}","releases_url":"https://api.github.com/repos/greenelab/hetmech/releases{/id}","deployments_url":"https://api.github.com/repos/greenelab/hetmech/deployments","created_at":"2016-07-21T21:25:53Z","updated_at":"2018-05-22T20:36:11Z","pushed_at":"2018-05-24T15:19:49Z","git_url":"git://github.com/greenelab/hetmech.git","ssh_url":"git@github.com:greenelab/hetmech.git","clone_url":"https://github.com/greenelab/hetmech.git","svn_url":"https://github.com/greenelab/hetmech","homepage":"","size":10286,"stargazers_count":6,"watchers_count":6,"language":"Jupyter Notebook","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":5,"mirror_url":null,"archived":false,"open_issues_count":8,"license":{"key":"other","name":"Other","spdx_id":null,"url":null},"forks":5,"open_issues":8,"watchers":6,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/greenelab/hetmech/pulls/109"},"html":{"href":"https://github.com/greenelab/hetmech/pull/109"},"issue":{"href":"https://api.github.com/repos/greenelab/hetmech/issues/109"},"comments":{"href":"https://api.github.com/repos/greenelab/hetmech/issues/109/comments"},"review_comments":{"href":"https://api.github.com/repos/greenelab/hetmech/pulls/109/comments"},"review_comment":{"href":"https://api.github.com/repos/greenelab/hetmech/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/greenelab/hetmech/pulls/109/commits"},"statuses":{"href":"https://api.github.com/repos/greenelab/hetmech/statuses/c055e6829f0db234c83f0c89faeaacf126e6a494"}},"author_association":"COLLABORATOR"}}
{"actor":{"display_login":"dhimmel"}}