Skip to content

Instantly share code, notes, and snippets.

@deque-blog
Created March 4, 2020 18:00
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 deque-blog/170a24c53d02e1eef71703aa04ae50a9 to your computer and use it in GitHub Desktop.
Save deque-blog/170a24c53d02e1eef71703aa04ae50a9 to your computer and use it in GitHub Desktop.
def expand_selection(self, states: Set[int]):
expanded = set()
to_expand = list(states)
while to_expand:
s = to_expand.pop()
expanded.add(s)
if s < len(self.nodes) and self.stars[s]:
if s+1 not in expanded:
states.add(s+1)
to_expand.append(s+1)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment