Euclidean Distance with Neo4j


I am new to Neo4j, I am trying to calculate the euclidean distance between two samples of data labeled as Fraud(targetIds) and not Fraud(sourceIds). I am trying to use that query below. I have an error but I cannot find the source of the error. I checked the values in sourceIds, targetIds, transactions everything is ok. Could someone please assist me?

Thank you

MATCH (tx:Transaction)-[r:COMPLETED]->(t:Terminal)
WITH {item:id(tx), fraud: tx.tx_Fraud, weights: collect(coalesce(r.score,
gds.util.NaN()))} AS userData
WITH collect(userData) AS transactions
WITH transactions,
[value in transactions WHERE value.fraud=0 | value.item ]
AS sourceIds
WITH transactions,
[value in transactions WHERE value.fraud=1 | value.item ]
AS targetIds,sourceIds
data: transactions,
sourceIds: sourceIds,
targetIds: targetIds,
topK: 1
YIELD item1, item2, similarity
WITH gds.util.asNode(item1) AS from, gds.util.asNode(item2) AS to, similarity
RETURN from.tx_Id AS from, to.tx_Id AS to, similarity
ORDER BY similarity DESC

log.txt (203.5 KB)