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.

How to set properties for nodes along a path

pborah88
Node Clone

I want to set a common property for all nodes in a single path.

I have a file dependency chain - (file)-[DEPENDS_ON*0..]->(file)

I want to calculate the length of each dependency path and set that length as a property for all nodes in that path. Here is my query -

match p=(f:FileName)-[r:DEPENDENT_ON*1..30]->(f1:FileName)
with p, length(p) as length, (nodes(p)) as nodes limit 10
unwind nodes as node
set node.group = length
return *

But the problem is certain nodes in a path do not get set with same property value of the path length.

1 REPLY 1

Could it be that different paths cross the same node and overwrite a previous node.group value?