Calculate dependencies between variables for cycle detection