added code to check for cycles in a directed graph and code to perform topological sort.