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.

Get node and relationship attributes from apoc.path.expand()

info6
Node Link

Hi

I am trying to get the distinct nodes and relationships from the following Cypher query:

MATCH (p:Person {name :'John James Smith'}) 
CALL apoc.path.expand(p,'former_member|current_member','+team|person',0,3) 
YIELD path as pp 
RETURN pp;

I have had some success in getting the node details by using UNWIND:

MATCH (p:Person {name :'John James Smith'}) 
CALL apoc.path.expand(p,'former_member|current_member','+team|person',0,3) 
yield path as pp 
UNWIND nodes(pp) as n
RETURN n.name as PName, n.team_nickname as NickName

but I'm not able to get anything about the relationships.

Any help or insights is greatly appreciated.

Cheers

1 REPLY 1

Can you call UNWIND relationships(pp) to get the relationships in the paths?

Elaine