BFS (breadth-first search)... «Грокаем структуры данных»

  • Аватар пользователя
    fru-n-quiz
    22 марта 2026
    BFS (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 vertex
    like1 понравилось
    6