{"action":"created","comment":{"url":"https://api.github.com/repos/twosigma/goll-e/pulls/comments/30465783","id":30465783,"diff_hunk":"@@ -144,111 +158,92 @@ var springForce = function(edge) {\n   //the minimum movement percentage to consider a move a change\n   //constant can be altered for desired effects (higher means less runs lower will\n   //be more accurate)\n-  var minLimit = 0.1;\n-\n-  if (vertexTo.get('isPinned') === false && vertexFrom.get('isPinned') === false) {\n-    vertexTo.set('position', {\n-      'x': (vertexTo.get('position').x + repulsionX),\n-      'y': (vertexTo.get('position').y + repulsionY)\n-    });\n-    vertexFrom.set('position', {\n-      'x': vertexFrom.get('position').x - repulsionX,\n-      'y': vertexFrom.get('position').y - repulsionY\n-    });\n-  } else if (vertexTo.get('isPinned') === true) {\n-    vertexFrom.set('position', {\n-      'x': vertexFrom.get('position').x - repulsionX - repulsionX,\n-      'y': vertexFrom.get('position').y - repulsionY - repulsionY\n-    });\n-\n-  } else if (vertexFrom.get('isPinned') === true) {\n-    vertexTo.set('position', {\n-      'x': (vertexTo.get('position').x + repulsionX + repulsionX),\n-      'y': (vertexTo.get('position').y + repulsionY + repulsionY)\n-    });\n-  }\n-  if (repulsionX > minLimit || repulsionY > minLimit || (repulsionX < -minLimit) || (repulsionY < -minLimit)) {\n-    change = true;\n-  }\n-};\n-\n-var portLayoutHelper = function(ports, cardinalDirection, maxPortsPerSide) {\n-  for(var j = 0; j < ports.length; j++) {\n-    var posPercentage = 12 + 15 * (j % maxPortsPerSide);\n-    if(j < maxPortsPerSide) {\n-      if(!ports[j].get('isPinned')) {\n-        ports[j].set('position', new CardinalPortPosition({direction: cardinalDirection, percentage: posPercentage}));\n-      }\n-    } else{\n-      if(cardinalDirection === CardinalDirection.WEST){\n-        cardinalDirection = CardinalDirection.SOUTH;\n-      } else if(cardinalDirection === CardinalDirection.EAST){\n-        cardinalDirection = CardinalDirection.NORTH;\n-      }\n-      if(!ports[j].get('isPinned')) {\n-        ports[j].set('position', new CardinalPortPosition({direction: cardinalDirection, percentage: posPercentage}));\n-      }\n-    }\n-  }\n-};\n-\n-var layoutPorts = function(graph) {\n-  var verts = graph.get('vertices');\n-  var maxPortsPerSide = 6;\n-  for(var i = 0; i < verts.length; i++) {\n-    var ins = verts[i].get('inputs');\n-    var outs = verts[i].get('outputs');\n-    portLayoutHelper(ins, CardinalDirection.WEST, maxPortsPerSide);\n-    portLayoutHelper(outs, CardinalDirection.EAST, maxPortsPerSide);\n+  //var minLimit = 0.1;\n+  var toIndex;\n+  var fromIndex;\n+  if(vertexTo.get('isPinned') === false && vertexFrom.get('isPinned') === false){\n+    toIndex = vertices.indexOf(vertexTo);\n+    vectors[toIndex].x += repulsionX;\n+    vectors[toIndex].y += repulsionY;\n+    vectors[toIndex].count += 1;\n+    fromIndex = vertices.indexOf(vertexFrom);\n+    vectors[fromIndex].x -= repulsionX;\n+    vectors[fromIndex].y -= repulsionY;\n+    vectors[fromIndex].count += 1;\n+\n+\n+  }else if(vertexTo.get('isPinned') === false){\n+\n+    toIndex = vertices.indexOf(vertexTo);\n+    vectors[toIndex].x += (repulsionX * 2);\n+    vectors[toIndex].y += (repulsionY * 2);\n+    vectors[toIndex].count ++;\n+\n+  }else if(vertexFrom.get('isPinned') === false){\n+    fromIndex = vertices.indexOf(vertexFrom);\n+    vectors[fromIndex].x -= (repulsionX * 2);\n+    vectors[fromIndex].y -= (repulsionY * 2);\n+    vectors[fromIndex].count ++;\n   }\n };\n \n-//Based partially on https://code.google.com/p/jung/source/browse/branches/\n-//guava/jung/jung-algorithms/src/main/java/edu/uci/ics/jung/algorithms/\n-//layout/SpringLayout.java?r=19\n-\n-/**\n- * Defines force directed layout algorithm\n- *\n- * @class forceDirectedLayout\n- *\n- */\n-\n-/**\n- * Takes the graph and re aligns the nodes\n- *\n- * Returns nothing\n- *\n- * @method layOutGraph\n- * @param  {Graph} graph\n- * @return nothing\n- */\n-\n-var layOutGraph = function(graph) {\n+ /**\n+     * Takes the graph and re aligns the nodes\n+     *\n+     * Returns nothing\n+     *\n+     * @method layOutGraph\n+     * @param  {Graph} graph\n+     * @return nothing\n+     */\n+\n+var layOutGraph = function(graph){","path":"lib/layout/forceDirectedLayout.js","position":302,"original_position":302,"commit_id":"057aa8d557912a140790618f00e2fb097782fac0","original_commit_id":"057aa8d557912a140790618f00e2fb097782fac0","user":{"login":"deviantbot","id":11306697,"avatar_url":"https://avatars.githubusercontent.com/u/11306697?v=3","gravatar_id":"","url":"https://api.github.com/users/deviantbot","html_url":"https://github.com/deviantbot","followers_url":"https://api.github.com/users/deviantbot/followers","following_url":"https://api.github.com/users/deviantbot/following{/other_user}","gists_url":"https://api.github.com/users/deviantbot/gists{/gist_id}","starred_url":"https://api.github.com/users/deviantbot/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/deviantbot/subscriptions","organizations_url":"https://api.github.com/users/deviantbot/orgs","repos_url":"https://api.github.com/users/deviantbot/repos","events_url":"https://api.github.com/users/deviantbot/events{/privacy}","received_events_url":"https://api.github.com/users/deviantbot/received_events","type":"User","site_admin":false},"body":"Function 'anonymous' has a complexity of 14. (complexity)","created_at":"2015-05-16T23:32:04Z","updated_at":"2015-05-16T23:32:04Z","html_url":"https://github.com/twosigma/goll-e/pull/44#discussion_r30465783","pull_request_url":"https://api.github.com/repos/twosigma/goll-e/pulls/44","_links":{"self":{"href":"https://api.github.com/repos/twosigma/goll-e/pulls/comments/30465783"},"html":{"href":"https://github.com/twosigma/goll-e/pull/44#discussion_r30465783"},"pull_request":{"href":"https://api.github.com/repos/twosigma/goll-e/pulls/44"}}},"pull_request":{"url":"https://api.github.com/repos/twosigma/goll-e/pulls/44","id":35578864,"html_url":"https://github.com/twosigma/goll-e/pull/44","diff_url":"https://github.com/twosigma/goll-e/pull/44.diff","patch_url":"https://github.com/twosigma/goll-e/pull/44.patch","issue_url":"https://api.github.com/repos/twosigma/goll-e/issues/44","number":44,"state":"open","locked":false,"title":"Vector math","user":{"login":"johnwobrien","id":1377204,"avatar_url":"https://avatars.githubusercontent.com/u/1377204?v=3","gravatar_id":"","url":"https://api.github.com/users/johnwobrien","html_url":"https://github.com/johnwobrien","followers_url":"https://api.github.com/users/johnwobrien/followers","following_url":"https://api.github.com/users/johnwobrien/following{/other_user}","gists_url":"https://api.github.com/users/johnwobrien/gists{/gist_id}","starred_url":"https://api.github.com/users/johnwobrien/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/johnwobrien/subscriptions","organizations_url":"https://api.github.com/users/johnwobrien/orgs","repos_url":"https://api.github.com/users/johnwobrien/repos","events_url":"https://api.github.com/users/johnwobrien/events{/privacy}","received_events_url":"https://api.github.com/users/johnwobrien/received_events","type":"User","site_admin":false},"body":"adds vector math and cleanup","created_at":"2015-05-16T23:15:57Z","updated_at":"2015-05-16T23:32:04Z","closed_at":null,"merged_at":null,"merge_commit_sha":"97757d4642a309721dea415bebf61d009ae753f4","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/twosigma/goll-e/pulls/44/commits","review_comments_url":"https://api.github.com/repos/twosigma/goll-e/pulls/44/comments","review_comment_url":"https://api.github.com/repos/twosigma/goll-e/pulls/comments{/number}","comments_url":"https://api.github.com/repos/twosigma/goll-e/issues/44/comments","statuses_url":"https://api.github.com/repos/twosigma/goll-e/statuses/057aa8d557912a140790618f00e2fb097782fac0","head":{"label":"twosigma:layout-Update","ref":"layout-Update","sha":"057aa8d557912a140790618f00e2fb097782fac0","user":{"login":"twosigma","id":4049181,"avatar_url":"https://avatars.githubusercontent.com/u/4049181?v=3","gravatar_id":"","url":"https://api.github.com/users/twosigma","html_url":"https://github.com/twosigma","followers_url":"https://api.github.com/users/twosigma/followers","following_url":"https://api.github.com/users/twosigma/following{/other_user}","gists_url":"https://api.github.com/users/twosigma/gists{/gist_id}","starred_url":"https://api.github.com/users/twosigma/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/twosigma/subscriptions","organizations_url":"https://api.github.com/users/twosigma/orgs","repos_url":"https://api.github.com/users/twosigma/repos","events_url":"https://api.github.com/users/twosigma/events{/privacy}","received_events_url":"https://api.github.com/users/twosigma/received_events","type":"Organization","site_admin":false},"repo":{"id":23775641,"name":"goll-e","full_name":"twosigma/goll-e","owner":{"login":"twosigma","id":4049181,"avatar_url":"https://avatars.githubusercontent.com/u/4049181?v=3","gravatar_id":"","url":"https://api.github.com/users/twosigma","html_url":"https://github.com/twosigma","followers_url":"https://api.github.com/users/twosigma/followers","following_url":"https://api.github.com/users/twosigma/following{/other_user}","gists_url":"https://api.github.com/users/twosigma/gists{/gist_id}","starred_url":"https://api.github.com/users/twosigma/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/twosigma/subscriptions","organizations_url":"https://api.github.com/users/twosigma/orgs","repos_url":"https://api.github.com/users/twosigma/repos","events_url":"https://api.github.com/users/twosigma/events{/privacy}","received_events_url":"https://api.github.com/users/twosigma/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/twosigma/goll-e","description":"Graph Object Language and Layout Editor","fork":false,"url":"https://api.github.com/repos/twosigma/goll-e","forks_url":"https://api.github.com/repos/twosigma/goll-e/forks","keys_url":"https://api.github.com/repos/twosigma/goll-e/keys{/key_id}","collaborators_url":"https://api.github.com/repos/twosigma/goll-e/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/twosigma/goll-e/teams","hooks_url":"https://api.github.com/repos/twosigma/goll-e/hooks","issue_events_url":"https://api.github.com/repos/twosigma/goll-e/issues/events{/number}","events_url":"https://api.github.com/repos/twosigma/goll-e/events","assignees_url":"https://api.github.com/repos/twosigma/goll-e/assignees{/user}","branches_url":"https://api.github.com/repos/twosigma/goll-e/branches{/branch}","tags_url":"https://api.github.com/repos/twosigma/goll-e/tags","blobs_url":"https://api.github.com/repos/twosigma/goll-e/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/twosigma/goll-e/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/twosigma/goll-e/git/refs{/sha}","trees_url":"https://api.github.com/repos/twosigma/goll-e/git/trees{/sha}","statuses_url":"https://api.github.com/repos/twosigma/goll-e/statuses/{sha}","languages_url":"https://api.github.com/repos/twosigma/goll-e/languages","stargazers_url":"https://api.github.com/repos/twosigma/goll-e/stargazers","contributors_url":"https://api.github.com/repos/twosigma/goll-e/contributors","subscribers_url":"https://api.github.com/repos/twosigma/goll-e/subscribers","subscription_url":"https://api.github.com/repos/twosigma/goll-e/subscription","commits_url":"https://api.github.com/repos/twosigma/goll-e/commits{/sha}","git_commits_url":"https://api.github.com/repos/twosigma/goll-e/git/commits{/sha}","comments_url":"https://api.github.com/repos/twosigma/goll-e/comments{/number}","issue_comment_url":"https://api.github.com/repos/twosigma/goll-e/issues/comments{/number}","contents_url":"https://api.github.com/repos/twosigma/goll-e/contents/{+path}","compare_url":"https://api.github.com/repos/twosigma/goll-e/compare/{base}...{head}","merges_url":"https://api.github.com/repos/twosigma/goll-e/merges","archive_url":"https://api.github.com/repos/twosigma/goll-e/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/twosigma/goll-e/downloads","issues_url":"https://api.github.com/repos/twosigma/goll-e/issues{/number}","pulls_url":"https://api.github.com/repos/twosigma/goll-e/pulls{/number}","milestones_url":"https://api.github.com/repos/twosigma/goll-e/milestones{/number}","notifications_url":"https://api.github.com/repos/twosigma/goll-e/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/twosigma/goll-e/labels{/name}","releases_url":"https://api.github.com/repos/twosigma/goll-e/releases{/id}","created_at":"2014-09-08T01:19:14Z","updated_at":"2015-05-06T08:59:24Z","pushed_at":"2015-05-16T23:15:58Z","git_url":"git://github.com/twosigma/goll-e.git","ssh_url":"git@github.com:twosigma/goll-e.git","clone_url":"https://github.com/twosigma/goll-e.git","svn_url":"https://github.com/twosigma/goll-e","homepage":null,"size":3053,"stargazers_count":4,"watchers_count":4,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":3,"mirror_url":null,"open_issues_count":4,"forks":3,"open_issues":4,"watchers":4,"default_branch":"master"}},"base":{"label":"twosigma:develop","ref":"develop","sha":"796a8300681b18a634db093f9edc0b1f6e15221e","user":{"login":"twosigma","id":4049181,"avatar_url":"https://avatars.githubusercontent.com/u/4049181?v=3","gravatar_id":"","url":"https://api.github.com/users/twosigma","html_url":"https://github.com/twosigma","followers_url":"https://api.github.com/users/twosigma/followers","following_url":"https://api.github.com/users/twosigma/following{/other_user}","gists_url":"https://api.github.com/users/twosigma/gists{/gist_id}","starred_url":"https://api.github.com/users/twosigma/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/twosigma/subscriptions","organizations_url":"https://api.github.com/users/twosigma/orgs","repos_url":"https://api.github.com/users/twosigma/repos","events_url":"https://api.github.com/users/twosigma/events{/privacy}","received_events_url":"https://api.github.com/users/twosigma/received_events","type":"Organization","site_admin":false},"repo":{"id":23775641,"name":"goll-e","full_name":"twosigma/goll-e","owner":{"login":"twosigma","id":4049181,"avatar_url":"https://avatars.githubusercontent.com/u/4049181?v=3","gravatar_id":"","url":"https://api.github.com/users/twosigma","html_url":"https://github.com/twosigma","followers_url":"https://api.github.com/users/twosigma/followers","following_url":"https://api.github.com/users/twosigma/following{/other_user}","gists_url":"https://api.github.com/users/twosigma/gists{/gist_id}","starred_url":"https://api.github.com/users/twosigma/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/twosigma/subscriptions","organizations_url":"https://api.github.com/users/twosigma/orgs","repos_url":"https://api.github.com/users/twosigma/repos","events_url":"https://api.github.com/users/twosigma/events{/privacy}","received_events_url":"https://api.github.com/users/twosigma/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/twosigma/goll-e","description":"Graph Object Language and Layout Editor","fork":false,"url":"https://api.github.com/repos/twosigma/goll-e","forks_url":"https://api.github.com/repos/twosigma/goll-e/forks","keys_url":"https://api.github.com/repos/twosigma/goll-e/keys{/key_id}","collaborators_url":"https://api.github.com/repos/twosigma/goll-e/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/twosigma/goll-e/teams","hooks_url":"https://api.github.com/repos/twosigma/goll-e/hooks","issue_events_url":"https://api.github.com/repos/twosigma/goll-e/issues/events{/number}","events_url":"https://api.github.com/repos/twosigma/goll-e/events","assignees_url":"https://api.github.com/repos/twosigma/goll-e/assignees{/user}","branches_url":"https://api.github.com/repos/twosigma/goll-e/branches{/branch}","tags_url":"https://api.github.com/repos/twosigma/goll-e/tags","blobs_url":"https://api.github.com/repos/twosigma/goll-e/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/twosigma/goll-e/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/twosigma/goll-e/git/refs{/sha}","trees_url":"https://api.github.com/repos/twosigma/goll-e/git/trees{/sha}","statuses_url":"https://api.github.com/repos/twosigma/goll-e/statuses/{sha}","languages_url":"https://api.github.com/repos/twosigma/goll-e/languages","stargazers_url":"https://api.github.com/repos/twosigma/goll-e/stargazers","contributors_url":"https://api.github.com/repos/twosigma/goll-e/contributors","subscribers_url":"https://api.github.com/repos/twosigma/goll-e/subscribers","subscription_url":"https://api.github.com/repos/twosigma/goll-e/subscription","commits_url":"https://api.github.com/repos/twosigma/goll-e/commits{/sha}","git_commits_url":"https://api.github.com/repos/twosigma/goll-e/git/commits{/sha}","comments_url":"https://api.github.com/repos/twosigma/goll-e/comments{/number}","issue_comment_url":"https://api.github.com/repos/twosigma/goll-e/issues/comments{/number}","contents_url":"https://api.github.com/repos/twosigma/goll-e/contents/{+path}","compare_url":"https://api.github.com/repos/twosigma/goll-e/compare/{base}...{head}","merges_url":"https://api.github.com/repos/twosigma/goll-e/merges","archive_url":"https://api.github.com/repos/twosigma/goll-e/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/twosigma/goll-e/downloads","issues_url":"https://api.github.com/repos/twosigma/goll-e/issues{/number}","pulls_url":"https://api.github.com/repos/twosigma/goll-e/pulls{/number}","milestones_url":"https://api.github.com/repos/twosigma/goll-e/milestones{/number}","notifications_url":"https://api.github.com/repos/twosigma/goll-e/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/twosigma/goll-e/labels{/name}","releases_url":"https://api.github.com/repos/twosigma/goll-e/releases{/id}","created_at":"2014-09-08T01:19:14Z","updated_at":"2015-05-06T08:59:24Z","pushed_at":"2015-05-16T23:15:58Z","git_url":"git://github.com/twosigma/goll-e.git","ssh_url":"git@github.com:twosigma/goll-e.git","clone_url":"https://github.com/twosigma/goll-e.git","svn_url":"https://github.com/twosigma/goll-e","homepage":null,"size":3053,"stargazers_count":4,"watchers_count":4,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":3,"mirror_url":null,"open_issues_count":4,"forks":3,"open_issues":4,"watchers":4,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/twosigma/goll-e/pulls/44"},"html":{"href":"https://github.com/twosigma/goll-e/pull/44"},"issue":{"href":"https://api.github.com/repos/twosigma/goll-e/issues/44"},"comments":{"href":"https://api.github.com/repos/twosigma/goll-e/issues/44/comments"},"review_comments":{"href":"https://api.github.com/repos/twosigma/goll-e/pulls/44/comments"},"review_comment":{"href":"https://api.github.com/repos/twosigma/goll-e/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/twosigma/goll-e/pulls/44/commits"},"statuses":{"href":"https://api.github.com/repos/twosigma/goll-e/statuses/057aa8d557912a140790618f00e2fb097782fac0"}}}}