Design a social graph
3473

Design a social network similar to FB/Linkedin. Major Features requested are

  1. ability to add person
  2. Ability to create/ remove connection between two users
  3. Find the number of connections (distance) between two users

I Solved this problem like any system design problem , by using a DB to store user data, and connection information. Application servers to run Bidirectional BFS on the user data to find the number of connection steps betweeen two users.

But how to maintain consistency in this case, if the BFS computation takes some time and in the mean time a new connection is added or removed which affects the BFS path calculated so far. How can we return the accurate result.

Other Requirements:

  • should be globally available
  • Should be reliable
Comments (1)