Add basic DFS algorithm to see if graph is acyclic.