cancel
Showing results for 
Search instead for 
Did you mean: 

Head's Up! These forums are read-only. All users and content have migrated. Please join us at community.neo4j.com.

When a path is matched, how to get ids of node and edge in a path

Hello!
How to get the id of each node and edge in a path, after "match p=()->(), return p".

2 REPLIES 2

Hello @ninesunqian

You should have a look at nodes() and relationships().

MATCH path=()->()
WITH nodes(path) AS n, relationships(path) AS r
RETURN [node in n | id(n)], r 

Be aware you can alo access start and end nodes in the result of relationships(path) for each relation.

Regards,
Cobra

Thanks you very much!