Gremlin: Unable to add edges to graph using console -


i have created graph using following command , not able find way in add edges it.

g = tinkergraph.open().traversal() g.addv('a1').addv('a2').addv('a3').addv('b3'). 

i have tried few variants of following command add edge.

g.v('a2').addedge('pre',v('a1')) no signature of method: org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.defaultgraphtraversal.addedge() applicable argument types: (java.lang.string, org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.defaultgraphtraversal) values: [pre, [graphstep(vertex,[a1])]] 

you didn't mention version you're using, i'll referring apache tinkerpop 3.2.3. here link documentation add edge step adde().

when created vertices, add vertex step addv() takes vertex label parameter, not id. vertex labels aren't unique, you're better off using id.

gremlin> gremlin.version() ==>3.2.3 gremlin> g = tinkergraph.open().traversal() ==>graphtraversalsource[tinkergraph[vertices:0 edges:0], standard] gremlin> g.addv('a1').addv('a2').addv('a3').addv('b3') ==>v[3] gremlin> g.v().valuemap(true) ==>[id:0,label:a1] ==>[id:1,label:a2] ==>[id:2,label:a3] ==>[id:3,label:b3] gremlin> g.v(1l).adde('pre').to(g.v(0l)) ==>e[4][1-pre->0] 

Comments

Popular posts from this blog

java - inputmismatch exception -

c - zlib and gdi32 with OpenSSL? -

Formatting string according to pattern without regex in php -