Better solution for avoiding breaking the graph