Hello,
I'm trying to use the CYPHER Reduce statement on the following:
Some nodes in the graph have properties: .A and .B which are numeric. For
every node that has these properties, I want to take the absolute value of
the difference between the two and sum across all nodes. I've tried the
Hi,
Which version are you using?
If you're on 2.0 then this should work:
MATCH c
WHERE HAS (c.A) AND HAS (c.B)
WITH collect(c) AS allC
RETURN reduce(total = 0, x IN allC| total + abs(x.A - x.B)) AS sum
and if on 1.9 then
START c=node(*)
WHERE HAS (c.A) AND HAS (c.B)
WITH collect(c) AS allC
Well on 1.9 you may need a with:
START c=node(*)
WHERE HAS (c.A) AND HAS (c.B)
WITH collect(c) AS allC
with reduce(total = 0, x IN allC| total + abs(x.A - x.B)) AS sum
return sum
On Fri, Jul 18, 2014 at 10:09 PM, Luanne Coutinho luanne.couti...@gmail.com
wrote:
Hi,
Which version are you