How do you detect a cycle in a graph?

Technical