Question: Thanks in advance! C++ Write a program to create and display a graph. Enhance the program to display the graph in either a breadth-first or
Write a program to create and display a graph. Enhance the program to display the graph in either a breadth-first or depth-first traversal.
Extra Credit: Enhance your program to display the graph in both a breadth-first and depth-first traversal.
Use the graph depicted in Figure 20-6 on page 1428 to test your program.
Depth First Traversal The depth first traversal i The general algorithm is as follows: for each vertex, v, in the graph s similar to the preorder traversal of a bina if v is not visited start the depth first traversal at v Consider the graph G of Figure 20-6. 3 1 7 2 FIGURE 20-6 Directed graph G
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
