Improve dependency graph creation
Since r af61bb8b76fb, the algorithm to create the graph went from linear to exponential order.
I think it can be simplified to stay linear (or at least close to linear).
Since r af61bb8b76fb, the algorithm to create the graph went from linear to exponential order.
I think it can be simplified to stay linear (or at least close to linear).