Code Room
System designHardsd-g300
Subject Graph db storageLevel Senior–Staff~50 minCommon in Databases & SQL · Storage & CDN · Algorithms & data structures interviewsIndustries Technology, Software development

Question

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.

Narrate your design
Loading whiteboard…
Run or narrate your approach, then ask the coach.