Rewrite creation of graphs