Pregunta de entrevista de Amazon

Write a function to detect if a graph is cyclic.