For undirected graphs , if we need to find a cycle , we use depth-first search as described in this older question,which is a well known method and also optimal .
But for directed graph, this other question suggests using topological sorting.
My question is, why can't we use the same technique we use for undirected graphs, to check for cycles in directed graph? I've thought of various cases and the algorithms always seem to agree.
Can anyone come up with some example directed graph where DFS fails to find a cycle but topological sorting does?