Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Please write a C program for this problem . Basically, you need to make a Menu using a while loop to choose an option. Sample:

Please write a C program for this problem. Basically, you need to make a Menu using a while loop to choose an option.

image text in transcribed

Sample:

image text in transcribed

image text in transcribed

Please do it as soon as posible

Exercise 1: Create and Display Graph Here you have to take number of nodes as input and the source and destination of connecting edge. After taking input display the full graph with number of edges and nodes Exercise 2: Add new vertex and edge Add a new vertex to the graph and add an edge between the two vertices of the graph. Exercise 3: Delete vertex Delete a vertex and its edges from the graph. Exercise 4: Traversal of graph (BFT and DFT) Given a graph find the Breadth First Traversal and Depth First traversal of the graph. To avoid processing a node more than once, we use a boolean visited array. For simplicity, it is assumed that all vertices are reachable from the starting vertex. #include int graph [50] [50]; int nodes; int edges; int main() { while(1) { printf("1. Create "); printf("2. Display "); printf("3. Add new edge "); printf("4. Delete edge "); printf("5. Add new vertex "); printf("6. Delete vertex "); printf("7. BFT traversal "); printf("8. DFT traversal "); int x; ; scanf("%d",&x); if(x==1) { createGraph(); } else if (x==2) { Output 1. Create 2. Display 3. Add new edge 4. Delete edge 5. Add new vertex 6. Delete vertex 7. BET traversal 8. DFT traversal 1 Enter number of nodes: 2 Enter number of edges: 1 3 2 1. Create 2. Display 3. Add new edge 4. Delete edge 5. Add new vertex 6. Delete vertex 7. BET traversal 8. DET traversal

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Concepts of Database Management

Authors: Philip J. Pratt, Mary Z. Last

8th edition

1285427106, 978-1285427102

Students also viewed these Databases questions