[ 
https://issues.apache.org/jira/browse/TINKERPOP-1284?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15264203#comment-15264203
 ] 

ASF GitHub Bot commented on TINKERPOP-1284:
-------------------------------------------

GitHub user okram opened a pull request:

    https://github.com/apache/incubator-tinkerpop/pull/298

    TINKERPOP-1284: StarGraph does not handle self-loops correctly.

    https://issues.apache.org/jira/browse/TINKERPOP-1284
    
    ```
    gremlin> graph = TinkerGraph.open()
    ==>tinkergraph[vertices:0 edges:0]
    gremlin>
    gremlin> v = graph.addVertex()
    ==>v[0]
    gremlin> v.addEdge("self",v)
    ==>e[1][0-self->0]
    gremlin> g = graph.traversal()
    ==>graphtraversalsource[tinkergraph[vertices:1 edges:1], standard]
    gremlin> g.V(0l)
    ==>v[0]
    gremlin>  g.V(0l).bothE()
    ==>e[1][0-self->0]
    ==>e[1][0-self->0]
    gremlin> g.V(0l).outE()
    ==>e[1][0-self->0]
    gremlin> g.V(0l).inE()
    ==>e[1][0-self->0]
    gremlin>
    gremlin>
    gremlin> starGraph = 
org.apache.tinkerpop.gremlin.structure.util.star.StarGraph.of(v)
    ==>stargraph[starOf:v[0]]
    gremlin> sg = starGraph.traversal()
    ==>graphtraversalsource[stargraph[starOf:v[0]], standard]
    gremlin> sg.V(0l)
    ==>v[0]
    gremlin> sg.V(0l).bothE()
    ==>e[1][0-self->0]
    ==>e[1][0-self->0]
    gremlin> sg.V(0l).outE()
    ==>e[1][0-self->0]
    gremlin> sg.V(0l).inE()
    ==>e[1][0-self->0]
    gremlin>
    gremlin> // TADA!
    ==>true
    gremlin>
    ```
    
    `mvn clean install` and Spark integration tests.
    
    VOTE +1

You can merge this pull request into a Git repository by running:

    $ git pull https://github.com/apache/incubator-tinkerpop TINKERPOP-1284

Alternatively you can review and apply these changes as the patch at:

    https://github.com/apache/incubator-tinkerpop/pull/298.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

    This closes #298
    
----
commit 0563ec36bb823d617acde6a15217c2b61471408d
Author: Marko A. Rodriguez <okramma...@gmail.com>
Date:   2016-04-29T15:33:29Z

    fixed a self-loop bug in StarGraph. Added 
StarGraphTest.shouldHandleSelfLoops() to ensure correct behavior.

----


> StarGraph does not handle self-loops correctly.
> -----------------------------------------------
>
>                 Key: TINKERPOP-1284
>                 URL: https://issues.apache.org/jira/browse/TINKERPOP-1284
>             Project: TinkerPop
>          Issue Type: Bug
>          Components: hadoop, structure
>    Affects Versions: 3.2.0-incubating, 3.1.2-incubating
>            Reporter: Marko A. Rodriguez
>
> {code}
> gremlin> graph = TinkerGraph.open()
> ==>tinkergraph[vertices:0 edges:0]
> gremlin> v = graph.addVertex()
> ==>v[0]
> gremlin> v.addEdge("self",v)
> ==>e[1][0-self->0]
> gremlin>
> gremlin> g = graph.traversal()
> ==>graphtraversalsource[tinkergraph[vertices:1 edges:1], standard]
> gremlin> g.V(0)
> gremlin> g.V(0l)
> ==>v[0]
> gremlin> g.V(0l).bothE()
> ==>e[1][0-self->0]
> ==>e[1][0-self->0]
> gremlin> g.V(0l).outE()
> ==>e[1][0-self->0]
> gremlin> g.V(0l).inE()
> ==>e[1][0-self->0]
> gremlin>
> /////////
> gremlin> starGraph = 
> org.apache.tinkerpop.gremlin.structure.util.star.StarGraph.of(v)
> ==>stargraph[starOf:v[0]]
> gremlin> sg = starGraph.traversal()
> ==>graphtraversalsource[stargraph[starOf:v[0]], standard]
> gremlin> sg.V(0l)
> ==>v[0]
> gremlin> sg.V(0l).bothE()
> ==>e[1][0-self->0]
> gremlin> sg.V(0l).outE()
> gremlin> sg.V(0l).inE()
> ==>e[1][0-self->0]
> gremlin>
> {code}



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to