- Related Questions & Answers
- Difference between BFS and DFS
- BFS vs DFS for Binary Tree in C++?
- Data objects and Structures
- Applications of Stack in Data Structure
- What are JavaScript data types and data structures?
- Principles of Recursion in Data Structures
- Binary Trees and Properties in Data Structures
- Kernel Data Structures
- Kinetic Data Structures
- Data structures of a Windows thread
- Abstract Data Type in Data Structures
- Difference between Stack and Queue Data Structures
- Comparison of Searching methods in Data Structures
- Comparison of Sorting methods in Data Structures
- Correspondence Based Data Structures

- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who

Here we will see what are the different applications of DFS and BFS algorithms of a graph?

The DFS or Depth First Search is used in different places. Some common uses are −

- If we perform DFS on unweighted graph, then it will create minimum spanning tree for all pair shortest path tree
- We can detect cycles in a graph using DFS. If we get one back-edge during BFS, then there must be one cycle.
- Using DFS we can find path between two given vertices u and v.
- We can perform topological sorting is used to scheduling jobs from given dependencies among jobs. Topological sorting can be done using DFS algorithm.
- Using DFS, we can find strongly connected components of a graph. If there is a path from each vertex to every other vertex, that is strongly connected.

Like DFS, the BFS (Breadth First Search) is also used in different situations. These are like below −

- In peer-to-peer network like bit-torrent, BFS is used to find all neighbor nodes
- Search engine crawlers are used BFS to build index. Starting from source page, it finds all links in it to get new pages
- Using GPS navigation system BFS is used to find neighboring places.
- In networking, when we want to broadcast some packets, we use the BFS algorithm.
- Path finding algorithm is based on BFS or DFS.
- BFS is used in Ford-Fulkerson algorithm to find maximum flow in a network.

Advertisements