
breadth-first search
Breadth-first search (BFS) is a method for exploring a network or a set of connected points (nodes). Starting from a chosen node, it visits all directly connected nodes first, then moves outward layer by layer, visiting nodes connected to those earlier nodes, and so on. This process ensures the shortest path to any node is found when all paths are equally accessible. BFS is useful for finding the shortest route, checking connectivity, and exploring graphs systematically, making it a fundamental technique in computer science and related fields.