Translate

Visit to www.mrmcse.com

10 March 2018

Write down the application of BFS and DFS algorithm




Breath first search (BFS): BFS is the traversing method used in graphs. It uses a queue for storing the visited vertices.

Application of BFS algorithm:

(i) Finding all connected components in a graph.

(ii) Finding the shortest path between two nodes.

(iii) Finding all nodes within one connected component.

(iv) Testing a graph for bipartiteness.

(v) In garbage collection.

(vi) Cycle detection in undirected graph.

(vii) Broad casting in network.

(viii) Peer to peer Networks.



Depth First Search (DFS): DFS traversing method used the stack for storing the visited vertices. DFS is the edge based algorithm.

Application of DFS algorithm:

(i) Topological sorting.

(ii) Finding connected components.

(iii) Solving puzzles such as maze.

(iv) Finding strongly connected components.

(v) Finding articulation points (cut vertices) of the graph.

(vi) Detection cycle in a graph.

(vii) To test if a graph is bipartite.

(viii) The inspection of two edge connected graph.





No comments:

Post a Comment