Skip to content

Commit 9867b09

Browse files
authored
Update Readme.md
1 parent e8f615c commit 9867b09

File tree

1 file changed

+12
-12
lines changed

1 file changed

+12
-12
lines changed

BFS/README.md

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -18,18 +18,18 @@ To make this process easy, use a queue to store the node and mark it as 'visited
1818
## Pseudocode
1919
```
2020
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.
2424
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
2828
v = Q.dequeue( )
2929
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+
```

0 commit comments

Comments
 (0)