The breadth-first search (BFS) algorithm is a traversing algorithm where you start at a selected node (the source or starting node) and traverse the graph layer-wise, exploring the neighboring nodes (nodes that are directly connected to the source node). You then move towards the neighboring nodes in the next level.
In this chapter, you will learn about BFS while developing LinkedIn's connection feature. You will learn how second-degree connections can be computed by using the BFS algorithm.
In this chapter, we will cover the following topics:
- Understanding the LinkedIn connection feature
- Graph data structure
- Queue data structure
- The BFS algorithm
- DFS versus BFS