Hi all,
I have more of a general development question. In terms of speed (storage) I’m trying to build and search a (small) social graph. (2 steps pf separation: known person -> friend -> friend --> 2nd known person)
_Step 1: _ Build the graph and store (once in a while refresh)
person 1 -> friends -> friends' friends
_Step 2: _ Search
see which friends of person 2 are in the friends’ friends of person 1
_Step 3: _ Show the matches
I consider two options for building / search:
Option 1:
Step 1: Small object (potential longer search?)
{'name': 'person 1', 'data': 'friend A, friend B'}
{'name': 'friend A', 'data': 'person 1, friend B, friend C'}
Step 2:
Search all ‘data’, get the ‘name’ from each match
Option 2:
Step 1 :bigger objects (potentially quicker search)
- Index with all people
{'person 1, friend A, friend B, person 1, friend B, friend C'}
- Object with parents of each index
{'name':'person 1', 'data':''}
{'name':'friend A', 'data':'person 1'}
{'name':'friend B', 'data':'person 1'}
{'name':'person 1', 'data':'person 1, friend A'}
{'name':'friend B', 'data':'person 1, friend A'}
Step 2:
The idea is then to search the index (probably quicker) and get the corresponding data parents pair from the Object.
Extra info:
content will be userids (only integers)
Any thoughts on search performance vs memory usage on these two different options?
thanks