Skip to content

Instantly share code, notes, and snippets.

@joaofig
Created July 9, 2023 21:15
Show Gist options
  • Select an option

  • Save joaofig/4bf53a36a71358fa73527e020f2d1f4d to your computer and use it in GitHub Desktop.

Select an option

Save joaofig/4bf53a36a71358fa73527e020f2d1f4d to your computer and use it in GitHub Desktop.
def get_successors(h0: int, h1: int) -> Counter:
cnt = get_cache_successors(h0, h1)
if cnt is None:
db = TrajDb()
sql = "select t2 from triple where t0=? and t1=?"
successors = [r[0] for r in db.query(sql, [int(h0), int(h1)])]
cnt = Counter(successors)
set_cache_successors(h0, h1, cnt)
return cnt
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment