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)

Was this helpful?

Give Feedback

How can we improve the documentation?

© 2024 DataStax | Privacy policy | Terms of use

Apache, Apache Cassandra, Cassandra, Apache Tomcat, Tomcat, Apache Lucene, Apache Solr, Apache Hadoop, Hadoop, Apache Pulsar, Pulsar, Apache Spark, Spark, Apache TinkerPop, TinkerPop, Apache Kafka and Kafka are either registered trademarks or trademarks of the Apache Software Foundation or its subsidiaries in Canada, the United States and/or other countries. Kubernetes is the registered trademark of the Linux Foundation.

General Inquiries: +1 (650) 389-6000, info@datastax.com