Bird
Raised Fist0
HLDsystem_design~10 mins

Social graph storage in HLD - Interactive Code Practice

Choose your learning style9 modes available
Practice - 5 Tasks
Answer the questions below
1fill in blank
easy

Complete the code to identify the main data structure used for storing user connections in a social graph.

HLD
The social graph is typically stored as a [1] where nodes represent users and edges represent connections.
Drag options to blanks, or click blank then click option'
Agraph
Barray
Cstack
Dqueue
Attempts:
3 left
💡 Hint
Common Mistakes
Choosing array because it stores lists but doesn't represent connections well.
Choosing stack or queue which are linear and don't model relationships.
2fill in blank
medium

Complete the code to describe the storage method for a social graph with millions of users.

HLD
For scalability, social graphs are often stored in a [1] database that supports relationships efficiently.
Drag options to blanks, or click blank then click option'
Akey-value
Bgraph
Crelational
Ddocument
Attempts:
3 left
💡 Hint
Common Mistakes
Choosing relational database which can be slow for complex graph queries.
Choosing key-value or document databases which don't natively support relationships.
3fill in blank
hard

Fix the error in describing how to represent user connections in adjacency form.

HLD
An adjacency list stores connections as a dictionary where keys are user IDs and values are lists of [1] user IDs.
Drag options to blanks, or click blank then click option'
Aconnected
Bunconnected
Crandom
Dinactive
Attempts:
3 left
💡 Hint
Common Mistakes
Choosing unconnected or inactive which do not represent actual connections.
Choosing random which is unrelated.
4fill in blank
hard

Fill both blanks to complete the description of a common query on social graphs.

HLD
To find mutual friends between two users, we compute the intersection of their [1] lists and then filter by [2].
Drag options to blanks, or click blank then click option'
Afriend
Bfollowers
Cactive
Dconnections
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'followers' which is a one-way relationship, not mutual.
Using 'friend' which is singular and less precise than 'connections'.
5fill in blank
hard

Fill all three blanks to complete the code snippet for storing social graph data efficiently.

HLD
storage = [1].partition_by([2]).replicate([3])
Drag options to blanks, or click blank then click option'
Agraph_db
Buser_id
C3
Drelational_db
Attempts:
3 left
💡 Hint
Common Mistakes
Using relational_db which is less efficient for graph data.
Incorrect replication factor or partition key.