Crash Fix for Graph cleanup MAGN-3977

RemoveTransitiveEdges() crashes while de-activating a null edge in
certain scenarios. Put a null check to avoid the crash.

Fixes http://adsk-oss.myjetbrains.com/youtrack/issue/MAGN-3977