Question: Write the C language code . Given a directed graph containing N nodes as an adjacency matrix,implement the following using a Breadth - First Search
Write the C language code Given a directed graph containing N nodes as an adjacency matrix,implement the following using
a BreadthFirst SearchBFS traversal algorithm:
Is Topological sort possible: This function checks whether topological sort can be done on
the graph or not. A topological sort is a linear ordering of the vertices in a Directed Acyclic
Graph DAG such that for every directed edge e e vertex e appears before e in
the ordering. Topological sort is possible if and only if the graph is a DAG.This function will
print if a topological sort is possible, otherwise.
Number of strongly components: This function analyzes the graph defined by the edges and
calculates the number of connected components.
Input format:
The first line contains an integer N specifying the number of nodes in the graph.
Each line of input is a character from the menu list tcx
Input t calls the function Is Topological sort possible
Input c calls the function Number of strongly components
Input x terminates the execution of the program
All the inputs in a line are separated by space.
Output Format:
A line may contain or
The output of the result of any menu is printed in a new line.
Sample Input :
t
c
x
Sample Output :
Sample Input :
t
c
x
Sample Output :
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
