Skip to content

Instantly share code, notes, and snippets.

@vladbatushkov
Last active May 30, 2020 06:21
Show Gist options
  • Save vladbatushkov/dfd632f58c8205654c042b080128355e to your computer and use it in GitHub Desktop.
Save vladbatushkov/dfd632f58c8205654c042b080128355e to your computer and use it in GitHub Desktop.
Find circular money flow in financial graph
PROFILE MATCH path = (t1:Transaction)-[:HOP*3..10]->(t2:Transaction)
WHERE (t1)<-[:OUT]-(:Client)-[:IN]->(t2)
AND t1.timestamp < t2.timestamp
AND (t1.amount - t2.amount) / t1.amount < 0.25
UNWIND nodes(path) as t
MATCH (e)-[:OUT]->(t)
WHERE e:Client OR e:Company
RETURN e, t
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment