change how to rewrite graph