File tree Expand file tree Collapse file tree 1 file changed +12
-12
lines changed Expand file tree Collapse file tree 1 file changed +12
-12
lines changed Original file line number Diff line number Diff line change @@ -18,18 +18,18 @@ To make this process easy, use a queue to store the node and mark it as 'visited
18
18
## Pseudocode
19
19
```
20
20
21
- BFS (G, s) //Where G is the graph and s is the source node
22
- let Q be queue.
23
- Q.enqueue( s ) //Inserting s in queue until all its neighbour vertices are marked.
21
+ BFS (G, s) //Where 'G' is the graph and 's' is the source node.
22
+ let 'Q' be a queue.
23
+ Q.enqueue( s ) //Inserting s in the queue until all its neighbouring vertices are marked.
24
24
25
- mark s as visited.
26
- while ( Q is not empty)
27
- //Removing that vertex from queue,whose neighbour will be visited now
25
+ mark 's' as visited.
26
+ while ( Q is not empty )
27
+ //Removing that vertex from queue, whose neighbour 'v' will be visited now
28
28
v = Q.dequeue( )
29
29
30
- //processing all the neighbours of v
31
- for all neighbours w of v in Graph G
32
- if w is not visited
33
- Q.enqueue( w ) //Stores w in Q to further visit its neighbour
34
- mark w as visited.
35
- ```
30
+ //processing all the neighbours of 'v'
31
+ for all neighbours 'w' of 'v' in Graph 'G'
32
+ if 'w' is not visited
33
+ Q.enqueue( w ) //Stores 'w' in 'Q' to further visit its neighbour
34
+ mark 'w' as visited.
35
+ ```
You can’t perform that action at this time.
0 commit comments