Question
Implement a directed social graph with `add_user`, `follow`, and `create_snapshot`. A snapshot must preserve the follow relationships that existed when it was created. Later mutations to the live graph must not change earlier snapshots. A snapshot supports `is_following`, `get_following`, `get_followers`, and `recommend`. Self-follows and repeated follows are no-ops. Rank recommendations by the number of two-hop mutual connections in descending order, then by `user_id` in ascending order; return at most `k` users. Exclude the requesting user and accounts they already follow. ## Follow-ups 1. Add `unfollow` while preserving earlier snapshots. 2. Avoid copying the full graph for every snapshot. 3. Discuss how recommendation ranking changes for a graph distributed across shards.