Google interview question

How to detect a circle in graph?