Write a complete C++ program that implements the Breadth First Search (BFS) Algorithm (Chapter 22). Your final submitted code and report should include some sample results that demonstrate that your code is successfully and correctly working. You need to present 3 samples. - You must ask the user to enter the number of vertices n for your graph, and go over the source vertices or nodes in numerical or alphabetical order. - Based on the number of vertices, randomly generate the edges. - Assume you are using the Adjacency Matrix to represent your graph. Assume you have an un-directed graph. Make sure that you ask the user to enter the number of vertices, Fixed number of vertices is not accepted. Use numeric numbers to name the vertices. Based on the number of vertices entered by the user, randomly generate the edges connected the vertices. Assume that you only allow undirected edges or undirected graph. Apply the BFS algorithm on the generated graph. Organize the resulted BFS Tree in a form of printed table similar to what we did in the class. In other words, for every node you show tree its color, parent, and distance from the source.
Write a complete C++ program that implements the Breadth First Search (BFS)
please solve it
show me 3 output
example about input
5 4
2 4
3 2
Trending now
This is a popular solution!
Step by step
Solved in 3 steps with 3 images