Code RoomDesign social graph edge storage
HardPrep Room Coding #3423

Design social graph edge storage

System designDatabases & SQLStorage & CDNSenior–Staff~50 min

Design the storage and access layer for the 'social graph' edge store behind a feature like 'mutual connections' and 'is A connected to B within 2 hops', on a single very large node store (sharding aside). Edges are typed (FRIEND, FOLLOW, BLOCK) and have properties (since, weight); degree is wildly skewed (median user ~150 edges, celebrities ~50M). The hot query intersects two users' neighbor sets and filters by edge type/property. Design how edges are stored and indexed so a 2-hop or intersection query is fast even when one endpoint is a celebrity, and the trade-off.

What a strong answer looks like

Clarify scale and constraints first. Propose a clean component breakdown, then go deep on the hard parts (data model, bottlenecks, consistency, failure modes) and name the trade-offs you are making.

Clarify5:30 left
Estimate5:30 planned
Design16:30 planned
Deep dive13:30 planned
Failure9:00 planned
0:00
Which questions mattered is sealed until you submit. Telling you now would just be handing over the edge cases.