← LinkedIn Interview Insights

LinkedIn·Software Engineer·Onsite - System Design / Architecture·Senior

SeniorPrefer not to say
May 2026

Summary

LinkedIn system design follow-up, the kind where they take a problem you already solved and ask what happens when you scale it by a factor of a thousand. No coding, just talking through tradeoffs for about an hour.

Questions Asked (1)

Q1

You've built a BFS-based shortest-distance function over a connection graph. Now imagine it runs in production at hundreds of millions of nodes. How do you redesign it to actually work at that scale?

System DesignAlgorithms & Data StructuresTechnical Trade-offs
Author's notes

This is the kind of question where you can tell they want you to keep talking and keep going deeper.

Create a free account to read the full note

AI HintsAI Generated

Suggested Approach

Start by acknowledging that a single-machine BFS won't scale, then propose a distributed BFS using a graph processing framework like Pregel or Giraph. Discuss partitioning strategies, communication overhead, and optimizations like bidirectional search or landmark-based approximations for specific use cases.

Pro tip: Mention that LinkedIn's graph is massive but often queries are for short distances (e.g., 1st, 2nd, 3rd degree connections), so precomputing and caching these common cases can drastically reduce load. Also, consider using a hybrid approach: exact BFS for short distances and approximate methods for longer ones.

1. Clarify requirements and constraints

Ask about the expected query patterns, latency requirements, and whether exact distances are always needed. This determines if you can use approximations or precomputation.

2. Choose a distributed graph processing model

Propose a vertex-centric model like Pregel where each node processes messages and votes to halt. Discuss partitioning the graph across machines to minimize cross-partition edges.

3. Optimize communication and storage

Use techniques like message combining, asynchronous execution, and compression to reduce network overhead. Consider storing the graph in a distributed key-value store with adjacency lists.

4. Leverage precomputation and caching

Precompute distances for common queries (e.g., 1st and 2nd degree connections) and cache results. Use a multi-level approach: exact for short distances, approximate for longer.

5. Discuss trade-offs and alternatives

Compare distributed BFS with bidirectional search, landmark-based methods (e.g., ALT), or graph embeddings. Highlight trade-offs in accuracy, latency, and resource usage.

Key Points to Mention

  • Distributed BFS using Pregel/Giraph with vertex-centric programming model
  • Graph partitioning strategies (e.g., edge-cut vs. vertex-cut) to minimize cross-machine communication
  • Precomputation and caching of short-distance queries (1st, 2nd, 3rd degree)
  • Approximation algorithms like landmark-based A* or graph embeddings for longer distances
  • Message combining and asynchronous execution to reduce network overhead
  • Hybrid approach: exact BFS for short distances, approximate for longer distances

AI-generated suggestions, not part of the candidate's original notes. May be inaccurate — verify before relying on them.