Java Program to Detect Cycle in a Directed Graph
Given a directed graph, check whether the graph contains a cycle. Your function should return true if the given graph contains at least one cycle; otherwise, it should return false.Example: Input:Â N = 4, E = 6 Output:Â Yes Explanation:Â The diagram clearly shows a cycle 0 -> 2 -> 0Input:Â N = 4,