PLEASE USE C LANGUAGE The objective is to be able to implement a graph data structure and graph traversals. 1. Make a code for a program that follows the details in the PROGRAM SPECIFICATION section. 2. Develop a program following the structured programming approach at the very least. No global variable declarations are allowed. The program specifications are as follows: Write a program that performs depth first search/traversal and breadth first search/traversal on predefined graphs. (see the attached pictures for predefined graphs) The graph search program will have the following main menu: Graph Traversal Program [1] Perform DFS Traversal [2] Perform BFS Traversal [3] Search Item using DFS [4] Search Item using BFS [0] Exit Enter choice: Details of the menu items are as follows: Perform DFS Traversal Once selected, the user is asked which graph to traverse. The program then performs depth-first search traversal and prints out the nodes in the order they are visited. Perform BFS Traversal Once selected, the user is asked which graph to traverse. The program then performs breadth first traversal and prints out the nodes in the order they are visited. Search Item using DFS Once selected, the user is asked what node to search and in which graph to search. The program then performs depth first search to search the node in the graph and prints a message stating if the node is part or not part of the graph. Search Item using BFS Once selected, the user is asked what node to search and in which graph to search. The program then performs breadth first search to search the node in the graph and prints a message stating if the node is part or not part of the graph. Exit Once selected, the program should terminate with a message informing the user that the program has ended. Note: At the end of each process, the program should display a message appropriate to the result of the process. After processing the selected main menu item, the program should loop back to the main menu. The program should end only when the user selects the main menu item Exit.
PLEASE USE C LANGUAGE
The objective is to be able to implement a graph data structure and graph traversals.
1. Make a code for a program that follows the details in the PROGRAM SPECIFICATION section.
2. Develop a program following the structured
The program specifications are as follows:
Write a program that performs depth first search/traversal and breadth first search/traversal on predefined graphs.
(see the attached pictures for predefined graphs)
The graph search program will have the following main menu:
Graph Traversal Program
[1] Perform DFS Traversal
[2] Perform BFS Traversal
[3] Search Item using DFS
[4] Search Item using BFS
[0] Exit
Enter choice:
Details of the menu items are as follows:
Perform DFS Traversal
Once selected, the user is asked which graph to traverse. The program then performs depth-first search traversal and prints out the nodes in the order they are visited.
Perform BFS Traversal
Once selected, the user is asked which graph to traverse. The program then performs breadth first traversal and prints out the nodes in the order they are visited.
Search Item using DFS
Once selected, the user is asked what node to search and in which graph to search. The program then performs depth first search to search the node in the graph and prints a message stating if the node is part or not part of the graph.
Search Item using BFS
Once selected, the user is asked what node to search and in which graph to search. The program then performs breadth first search to search the node in the graph and prints a message stating if the node is part or not part of the graph.
Exit
Once selected, the program should terminate with a message informing the user that the program has ended.
Note: At the end of each process, the program should display a message appropriate to the result of the process. After processing the selected main menu item, the program should loop back to the main menu. The program should end only when the user selects the main menu item Exit.
Step by step
Solved in 3 steps with 5 images