addE
Specify an edge from a traversal.
Synopsis
g.V(vertex) .addE('edgeLabel') .to(vertex)
Description
The addE()
step is a map of sideEffect.
An edge is added from a traversal g using addE
between two existing vertices.
A previously created edge label must be specified.
Examples
Create an edge with an edge label knows
between two vertices, stephenSmith
and johnDoe
.
The first two lines assign the already existing vertices to variable names for use in the addE()
step.
// Get two users to join with an edge
johnDoe = g.V().has('name','John Doe').next()
stephenSmith = g.V().has('name','Stephen Smith').next()
// Create the edge between Stephen and John
g.V(stephenSmith).addE('knows').to(johnDoe)