Citadel interview question

How would you detect cycles in a directed graph