Matteo,
you can try:
MATCH (a:Label {id:1}),(b:Label {id:2})
WITH [ idx in range(0,size(a.prop)-1) WHERE a.prop[idx] != b.prop[idx] |
a.prop[idx] - b.prop[idx] ] as diff
SET a.diff = diff
RETURN diff, [x in diff WHERE x < 0.1] as below_treshold
Cypher has a number of really useful collection functions like extract, filter,
reduce, collect, size but also subscripts etc.
HTH
Michael
> Am 01.04.2016 um 21:47 schrieb Matteo Rucco <[email protected]>:
>
> Dear all,
>
> I hope this finds you well. I am learning how to use cypher and I am having
> some difficulties to implement a query. Suppose you have two nodes, say n1
> and n2, within the same label. Both n1 and n2 have a property that is an
> array (say measures). Is it possible to compute the difference between the
> measures[i] of n1 and measures[i] of n2 and to store the differences in a new
> array (say it diff). Moreover, is it possible to count how many elements in
> diff are less than a threshold?
>
> Thanks in advance,
>
> Matteo
>
> --
> You received this message because you are subscribed to the Google Groups
> "Neo4j" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected]
> <mailto:[email protected]>.
> For more options, visit https://groups.google.com/d/optout
> <https://groups.google.com/d/optout>.
--
You received this message because you are subscribed to the Google Groups
"Neo4j" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.