Getting Neo4J Relationships
So you have a collection of nodes and relationships in your Neo4j database, and want to get just the relationships?
(# indicates the node ID)
All relationships / edges
Cypher:
START n=node(#) MATCH n-[rel]-out RETURN rel
Gremlin:
g.v(#).bothE
Incoming relationships / edges
Cypher:
START n=node(#) MATCH n<-[rel]-out RETURN rel
Gremlin:
g.v(#).inE
Outgoing relationships / edges
Cypher:
START n=node(#) MATCH n-[rel]->out RETURN rel
Gremlin:
g.v(#).outE
Written by Chris Skardon
Related protips
Have a fresh tip? Share with Coderwall community!
Post
Post a tip
Sponsored by #native_company# — Learn More
#native_title#
#native_desc#