$ ~/back-of-the-envelope
[007] compute

How many friend relationships exist in a 100M-user social network?

easy graphsocial-mediacapacity-planningdata-structures

The scenario

You’re designing the data layer for a social graph service — think Facebook friends or LinkedIn connections. The network has 100 million active users. Based on usage data, the average user maintains 50 friend connections.

Friend relationships are bidirectional and stored as directed edges (each friendship stored once per direction for fast lookup).

How many total friend relationships does the database need to store? Express your answer in billions.

Adapted from: donnemartin/system-design-primer — Design a Social GraphCC BY 4.0

$answer:billion relationships