Write a program (WAP) in c to create an undirected graph using adjacency matrix representation. Number of nodes and edges should be taken from the user. After creating the graph, perform following operations: (i) Search a node. Take the node number from the user. If the node is found then print its associated edges. (ii) Insert a node in the graph. (iii) Insert an edge in the graph. Take the node numbers from the user between which the edge is to be inserted.
Write a program (WAP) in c to create an undirected graph using adjacency matrix representation.
Number of nodes and edges should be taken from the user. After creating the graph, perform
following operations:
(i) Search a node. Take the node number from the user. If the node is found then print its associated
edges.
(ii) Insert a node in the graph.
(iii) Insert an edge in the graph. Take the node numbers from the user between which the edge is to
be inserted.
(iv) Delete a node from the graph. Take the node number to be deleted from the user.
(v) Apply DFS on the graph and print the graph traversal.
(vi) Apply BFS on the graph and print the graph traversal.
2. Solve the above problem using adjacency list representation.
Trending now
This is a popular solution!
Step by step
Solved in 2 steps