Skip to content

Commit c0abd57

Browse files
authored
Update README.md
1 parent a0f6c5c commit c0abd57

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

Graphs/Breadth First Search/README.md

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
Two techniques are frequently used for graph traversal: These techniques are called depth-first search (DFS) and breadth-first search (BFS), although we will just talk about BFS. Breadth-first search (BFS) is used to solve many problems, including finding the shortest path in a graph or solving puzzle games such as Rubik’s Cubes.
33

44
## What is Breadth First Search in Python?
5-
Breadth-first search (BFS) is an algorithm for traversing graphs or trees. Breath-first search for trees and graphs are almost the same. BFS uses a queue data structure for finding the shortest path in a graph.
5+
Breadth-first search (BFS) is an algorithm for traversing graphs or trees. Breath-first search for trees and graphs are almost the same. BFS uses a queue data structure for finding the shortest path in a graph. We use queue to get the next vertex to start the search, and the visited array is used to mark all the nodes that have been visited, so when it appears again, we will perform BFS on that node.
66

77
## Algorithm of DFS in Python
88
The algorithm works as follows:
@@ -18,6 +18,12 @@ The algorithm works as follows:
1818
* Time complexity is `O(V+E)`, where V denotes the number of vertices and E denotes the number of edges.
1919
* Space complexity is `O(V)`.
2020

21+
## Applications of Breadth First Search
22+
* Crawlers in Search Engines
23+
* Peer-to-Peer Networking
24+
* GPS Navigation Systems
25+
* Ford-Fulkerson algorithm
26+
2127
## Input & Output
2228
### Input:
2329

0 commit comments

Comments
 (0)