Skip to content

Instantly share code, notes, and snippets.

@awwong1
Last active August 25, 2016 16:37
Show Gist options
  • Save awwong1/c5c3bb264f02d97e2c87f141f580bbbb to your computer and use it in GitHub Desktop.
Save awwong1/c5c3bb264f02d97e2c87f141f580bbbb to your computer and use it in GitHub Desktop.
{
uid: (node_uid)
submitter_uid: (user_uid)
text: blah
markdown: blah
image: blah
video: blah
...
required_uids: (set of node_uids)
# excluded_uids: (set of node_uids) (maybe this is impossible to do 'well')
child_uids: (set of node_uids OR node object literals)
... (random other fields that I make up as I go)
}
Example Use Case:
A A: child_uids = ['B', 'C']
/ \
/ B
C C: required_uids = ['B']
As you walk through the tree, you populate your own internal list UIDs that you've seen.
Nodes with required_uids will unlock as you travel through the graph.
Bonus Case:
D D: child_uids = ['E', 'F']
/ \
/ E
F F: excluded_uids = ['E']
If at any point you visit node 'E', you will no longer be able to travel to node 'F'.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment