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

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

Github user dalaro commented on a diff in the pull request:

    https://github.com/apache/incubator-tinkerpop/pull/298#discussion_r61604599
  
    --- Diff: 
gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/util/star/StarGraph.java
 ---
    @@ -290,7 +288,16 @@ public void dropVertexProperties(final String... 
propertyKeys) {
     
             @Override
             public Edge addEdge(final String label, final Vertex inVertex, 
final Object... keyValues) {
    -            return this.addOutEdge(label, inVertex, keyValues);
    +            final Edge edge = this.addOutEdge(label, inVertex, keyValues);
    +            if (inVertex.equals(this)) {
    +                List<Edge> inE = inEdges.get(label);
    --- End diff --
    
    inEdges may be null here on a pristine StarVertex


> 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