Problem. An interaction log lists pairs of users who interacted (messaged, co-edited, followed each other). Treat it as an undirected graph. For a user u, recommend the top k users u is not yet connected to, ranked by the number of mutual connections (friends of friends), ties broken by user id.
log: (ana, bo) (ana, cy) (bo, dee) (cy, dee) (cy, eli) (bo, eli) (dee, fay)
recommend(ana, k = 2) → [dee (2 mutual: bo, cy), eli (2 mutual: bo, cy)]
Mutual-friend counting is the classic "people you may know" signal, and the neighbourhood questions around it (k-hop reach, communities) are BFS and connected components from lessons 11.1 and 11.8, on a graph where a few users have enormous degree.
ML context. Recommender systems generate candidates from the user graph (friends of friends, items co-interacted by similar users) before a model ranks them. Graph neural networks compute each node's representation from its sampled k-hop neighbourhood. Fraud and abuse teams look at connected components of accounts linked by interactions. Each needs fast neighbourhood queries on a graph with millions of nodes and heavy-tailed degrees.