Optimize graph to switch arrows

instead of deleting and recreating them