How can we detect if a directed graph is cyclic? I thought using breadth first search, but I\'m not sure. Any ideas?
Testing for Topological sort over the given graph will lead you to the solution. If the algorithm for topsort, i.e the edges should always be directed in one way fails, then it means that the graph contains cycles.