intermediateNeo4j — Graph Database & Cypher Queries
Your fraud detection team wants to identify accounts that are part of a ring of money transfers (circular transactions). How do you implement this in Neo4j?
MATCH cycle = (account:Account)-[:TRANSFERRED_TO*3..7]->(account) WHERE all(rel IN relationships(cycle) WHERE rel.amount > 5000 AND rel.timestamp > datetime()-duration('P7D')) WITH account, length(cycle) AS cycleLength, [r IN relationships(cycle) | r.amount] AS amounts RETURN DISTINCT account.accountNumber, cycleLength, reduce(total=0, a IN amounts | total + a) AS totalMoneyInCycle ORDER BY totalM
This is a Pro chapter
Sign in, then upgrade to Pro or Power to unlock this and the full Databases Mastery library.
Your fraud detection team wants to identify accounts that are part of a ring of money transfers (circular transactions). How do you implement this in Neo4j?