Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.
Sign upCreate Kahns.java #1491
Create Kahns.java #1491
Conversation
It is an algorithm to find cycle in the graph if any otherwise the graph is acyclic and will give the topological ordering of the graph. Following are some test cases: Enter the numer of vetrices: 4 Enter the numer of edges: 3 Enter e edges 0 1 1 3 2 3 Output : 0 2 1 3 Enter the numer of vetrices: 4 Enter the numer of edges: 4 Enter e edges 0 1 1 2 3 1 2 0 Output :The graph has cycle
It is an algorithm to find cycle in the graph if any otherwise the graph is acyclic and will give the topological ordering of the graph.
Following are some test cases:
Enter the numer of vetrices:
4
Enter the numer of edges:
3
Enter e edges
0 1
1 3
2 3
Output : 0 2 1 3
Enter the numer of vetrices:
4
Enter the numer of edges:
4
Enter e edges
0 1
1 2
3 1
2 0
Output :The graph has cycle
Describe your change:
References
Checklist:
Fixes: #{$ISSUE_NO}.