Given a dependency graph of design tasks, determine the order in which tasks should be completed and detect cycles.