I got this question, and I'd be happy for help.
There is a graph G=(V,E), directed graph, and F is subset of E.
I need an algorithm which find if there is a cycle composed from one (or more) of the edges in F. This must run in O(|V|+|E|).
I tried to run DFS twice: one on the original graph, and one on G'=(V,E/F), but the main problem that it not decisive about situation when in the first and the second run, I got that there is a cycle in the graph.
Any suggestions? Thank you!