Using BreadthFirst search for Undirected Graphs complete the
Using Breadth-First search for Undirected Graphs, complete the table starting at 0.
Solution
This algorithm for BFS(Breadth First Search) is:
1.Add a random vertex to the queue.
2. Add all adjacent univisited vertices to the vertex at the front of the queue.
3. Remove the vertex from the front of the queue.
4. If stack is not empty, go to step 2.
| v | edgeTo | distTo |
| 0 | - | 0 |
| 1 | 0 | 1 |
| 2 | 0 | 1 |
| 3 | 4 | 3 |
| 4 | 2 | 2 |
| 5 | 6 | 2 |
| 6 | 0 | 1 |
