function reduce(accumulator = initial, variable IN list | expression)
To run an expression against individual elements of a list, and store the result of the expression in an accumulator,
you can use reduce(). It will go through a list, run an expression on every element, storing the partial result in the accumulator.
It works like the fold or reduce method in functional languages such as Lisp and Scala.
Arguments:
MATCH p=(a)-->(b)-->(c) WHERE a.name='Alice' AND b.name='Bob' AND c.name='Daniel' RETURN reduce(totalAge = 0, n IN nodes(p)| totalAge + n.age) AS reduction