Detect circular dependencies