Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Neo4j Cypher Get Relationship Direction

Tags:

neo4j

cypher

I have following cypher query which returns all (in and out) relationships of an specific node:

START s=node(1) MATCH s<-[r]->(t) RETURN type(r) as RelationshipType, .......

Now I want to find out the direction of each relationship. Is there an command like "RETURN RelationshipDirection(r)" ?? :)

Thanks.

like image 899
user1401611 Avatar asked Feb 19 '23 22:02

user1401611


2 Answers

Per neo4j 2.0, you can use startnode(r)

See http://docs.neo4j.org/chunked/snapshot/query-functions-scalar.html#functions-startnode

STARTNODE returns the starting node of a relationship

So in your example you might find outgoing relations by startnode(r) = s

like image 91
bebbi Avatar answered Feb 23 '23 08:02

bebbi


Unfortunately, that's not possible right now using Cypher. Here is an issue for it. Please add any comments you might have.

Andrés

like image 41
Andres Avatar answered Feb 23 '23 07:02

Andres