JDRF Electromag interview question

How would you detect if a directed graph contains a cycle? Provide an algorithm to solve this problem.