For the sake of debuggability, DependencyGraph is (as of #98) using a bunch of off-the-shelf datastructures (both for storing true data and checking invariants). The true data structures can be replaced with versions more optimized to our usage patterns; the invariant-checking data structures can be made debug-mode only, so release-mode code doesn't have to pay the cost of checking them.