Why you use DFS and BFS in graphs?

1 answer

Answer

1136442

2026-02-20 10:55

+ Follow

DFS and BFS are both searching algorithms.

DFS, or depth first search, is a simple to implement algorithm, especially when written recursively.

BFS, or breadth first search, is only slightly more complicated.

Both search methods can be used to obtain a spanning tree of the graph, though if I recall correctly, BFS can also be used in a weighted graph to generate a minimum cost spanning tree.

ReportLike(0ShareFavorite

Copyright © 2026 eLLeNow.com All Rights Reserved.