{"action":"created","issue":{"url":"https://api.github.com/repos/apache/tinkerpop/issues/372","repository_url":"https://api.github.com/repos/apache/tinkerpop","labels_url":"https://api.github.com/repos/apache/tinkerpop/issues/372/labels{/name}","comments_url":"https://api.github.com/repos/apache/tinkerpop/issues/372/comments","events_url":"https://api.github.com/repos/apache/tinkerpop/issues/372/events","html_url":"https://github.com/apache/tinkerpop/pull/372","id":169296954,"number":372,"title":"DSP-1397 Fix StarGraph addEdge for self-edges","user":{"login":"dalaro","id":260045,"avatar_url":"https://avatars.githubusercontent.com/u/260045?v=3","gravatar_id":"","url":"https://api.github.com/users/dalaro","html_url":"https://github.com/dalaro","followers_url":"https://api.github.com/users/dalaro/followers","following_url":"https://api.github.com/users/dalaro/following{/other_user}","gists_url":"https://api.github.com/users/dalaro/gists{/gist_id}","starred_url":"https://api.github.com/users/dalaro/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dalaro/subscriptions","organizations_url":"https://api.github.com/users/dalaro/orgs","repos_url":"https://api.github.com/users/dalaro/repos","events_url":"https://api.github.com/users/dalaro/events{/privacy}","received_events_url":"https://api.github.com/users/dalaro/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":3,"created_at":"2016-08-04T05:55:31Z","updated_at":"2016-08-05T17:28:42Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/apache/tinkerpop/pulls/372","html_url":"https://github.com/apache/tinkerpop/pull/372","diff_url":"https://github.com/apache/tinkerpop/pull/372.diff","patch_url":"https://github.com/apache/tinkerpop/pull/372.patch"},"body":"StarGraph has directionally-specific classes for its edges:\r\n\r\n* StarInEdge\r\n* StarOutEdge\r\n\r\nStarIn(/Out)Edges belong only in a StarVertex's in(/out)Edges map.  We\r\nsee this assumption in StarVertex.applyGraphFilter, which invokes\r\n`graphFilter.legalEdges(this)` and then invokes `instanceof\r\nStarOutEdge` on each legal edge to determine its direction.\r\n\r\nThis assumption was violated by the StarVertex.addEdge method.  This\r\nmethod special-cases self-edge addition.  This method first\r\nunconditionally adds a StarOutEdge.  Then, it checks to see whether\r\nits parameters indicate that it is adding a self-edge.  If this is so,\r\nthe method proceeds to add that same StarOutEdge instance to the\r\ninEdges map.  This is the problem.  Adding a self-edge to a StarVertex\r\nresults in one StarOutEdge instance that belongs to both the inEdges\r\nand outEdges map, which later causes the `applyGraphFilter` method's\r\n`instanceof` checks to yield two out edges and no in edges on a\r\nself-loop.\r\n\r\nThis commit changes StarVertex so that self-edges are represented\r\nby a new class, StarSelfEdge."},"comment":{"url":"https://api.github.com/repos/apache/tinkerpop/issues/comments/237911662","html_url":"https://github.com/apache/tinkerpop/pull/372#issuecomment-237911662","issue_url":"https://api.github.com/repos/apache/tinkerpop/issues/372","id":237911662,"user":{"login":"dalaro","id":260045,"avatar_url":"https://avatars.githubusercontent.com/u/260045?v=3","gravatar_id":"","url":"https://api.github.com/users/dalaro","html_url":"https://github.com/dalaro","followers_url":"https://api.github.com/users/dalaro/followers","following_url":"https://api.github.com/users/dalaro/following{/other_user}","gists_url":"https://api.github.com/users/dalaro/gists{/gist_id}","starred_url":"https://api.github.com/users/dalaro/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dalaro/subscriptions","organizations_url":"https://api.github.com/users/dalaro/orgs","repos_url":"https://api.github.com/users/dalaro/repos","events_url":"https://api.github.com/users/dalaro/events{/privacy}","received_events_url":"https://api.github.com/users/dalaro/received_events","type":"User","site_admin":false},"created_at":"2016-08-05T17:28:42Z","updated_at":"2016-08-05T17:28:42Z","body":"Thanks for the replies.\r\n\r\n@spmallette I will investigate whether this behavior also exists on 3.1 and retarget if so.  I think this will involve making a standalone test instead of just testing TP against my app and stimulating the failure that way.\r\n\r\n@okram Yes, I realize that bothE() should return two edges.  The problem this PR tried to address was that, after applying an inE graph filter to a self-looped StarVertex, the StarVertex had two edges in its outEdges map and no edges in its inEdges map (should be one each).  I think this is not just some obscure internals problem, because I discovered it through a traversal.  Maybe I can articulate this better with a test."}}
{"actor":{"display_login":"dalaro"}}