Prevent loops in task dependencies.