Skip to content

Instantly share code, notes, and snippets.

@vladbatushkov
Last active May 3, 2019 16:36
Show Gist options
  • Save vladbatushkov/cb9eb9fcb266bdaec2c35939e75dcdfb to your computer and use it in GitHub Desktop.
Save vladbatushkov/cb9eb9fcb266bdaec2c35939e75dcdfb to your computer and use it in GitHub Desktop.
Join working days and weekends into year day by day.
UNWIND apoc.coll.pairsMin(range(1, 365)) as pair
MATCH (w1)
WHERE (w1:WorkingDay OR w1:Weekend) AND w1.day.ordinalDay = pair[0]
MATCH (w2)
WHERE (w2:WorkingDay OR w2:Weekend) AND w2.day.ordinalDay = pair[1]
MERGE (w1)-[:NEXT]->(w2)
RETURN w1, w2
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment