Skip to content

Instantly share code, notes, and snippets.

@elisedeux
Created March 26, 2019 08:46
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save elisedeux/1334304a8ea4f55bb3896e782ddca497 to your computer and use it in GitHub Desktop.
Save elisedeux/1334304a8ea4f55bb3896e782ddca497 to your computer and use it in GitHub Desktop.
MATCH p=(a:Company)-[rs:SELLS_TO*]->(c:Company)
WHERE a.country <> c.country
WITH p, a, c, rs, nodes(p) AS ns
WITH p, a, c, rs, filter(n IN ns WHERE n.epoch - 1383123473 < (90*60*60*24)) AS bs
WITH p, a, c, rs, head(bs) AS b
WHERE NOT b IS NULL
WITH p, a, b, c, head(rs) AS r1, last(rs) AS rn
WITH p, a, b, c, r1, rn, rn.epoch - r1.epoch AS d
WHERE d < (15*60*60*24)
RETURN a, b, c, d, r1, rn
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment