- Trending Categories
- Data Structure
- Networking
- RDBMS
- Operating System
- Java
- MS Excel
- iOS
- HTML
- CSS
- Android
- Python
- C Programming
- C++
- C#
- MongoDB
- MySQL
- Javascript
- PHP
- Physics
- Chemistry
- Biology
- Mathematics
- English
- Economics
- Psychology
- Social Studies
- Fashion Studies
- Legal Studies

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

# Applications of DFS and BFS in Data Structures

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.

- Related Articles
- Difference between BFS and DFS
- BFS vs DFS for Binary Tree in C++?
- Data objects and Structures
- Principles of Recursion in Data Structures
- Binary Trees and Properties in Data Structures
- Abstract Data Type in Data Structures
- What are JavaScript data types and data structures?
- What are compound data types and data structures in Python?
- Applications of Stack in Data Structure
- Kernel Data Structures
- Kinetic Data Structures
- Comparison of Searching methods in Data Structures
- Comparison of Sorting methods in Data Structures
- Tail Recursion in Data Structures
- Bernoulli Distribution in Data Structures

Advertisements