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.

Neo4j query return node parameters in recursve loop

I have a dynamic hierarchy of nodes & relations and want to extract max of a Node (p) associated in that hirerchy . Snippet of hierarchies is as under
EG:-p1<-p2<-p4<-p5
p1<-p2<-p4<-p6
p1<-p3<-p7<-p8
p1<-p3<-p7<-p9

I have a node c..n having relationship with each of pn nodes , I need to get maximum of property of the c..n node in each pth mentioned above.
I am using -[:has_relation*]- to traverse the tree , but moment i specify p1.property1=67 and pn.property=100 , i get a single row.
I need all rows corresponding to the path and maximum of property associated with each subnode.

each Subnode:-
(pn)-[:has_other_relation]->(c_node_n)

Is it possible to get this in Neo4j ?
Have thought of using FOREACH, but its used for merging/creating new relation/property not returning anything.

1 REPLY 1

Usually you can use a path expression:

like this:

MATCH path (r:Node {id:root})-[:HAS_CHILD*]->(c) WHERE not (c)-[:HAS_CHILD]->()
RETURN path

or the other way round if you want to start at the child