cycle.cpp - finds whether a directed graph has a cycle