Optimisation for graph closure.