BFS (breadth-first search)... «Грокаем структуры данных»
fru-n-quiz22 марта 2026BFS (breadth-first search) explores the graph in concentric rings of increasing distance from the start vertex. Thus, it expands the frontier of visited vertices like a wave, in all directions. The opposite choice would be to go as deep into the graph as possible, and that’s what depth-first search (DFS) does. We must choose a start vertex s, and then the algorithm follows one path from s to its end. When the end of a path is reached, it goes back until it finds a vertex1 понравилось
6