Skip to content

Instantly share code, notes, and snippets.

@Hkazanci93
Created October 28, 2021 10:01
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 Hkazanci93/853d06eb51b04db09911058e4040e0fe to your computer and use it in GitHub Desktop.
Save Hkazanci93/853d06eb51b04db09911058e4040e0fe to your computer and use it in GitHub Desktop.
MATCH (src:Station{id: $src})
MATCH (dst:Station{id: $dst})
MERGE (src)-[t:Trip]->(dst)
ON CREATE
SET t.counts = [n in range(0, 167) | CASE WHEN n = $hour THEN 1 ELSE 0 END]
ON MATCH
SET t.counts = t.counts[0..$hour] + [t.counts[$hour]+1] + t.counts[($hour+1)..168]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment