2. The method of claim 1 , wherein the method further comprises: (a) computing a second rewriting rule that specifies: (i) a second part of the old input graph to be replaced, (ii) a part of the old output graph to replace the second part of the old input graph, and (iii) a second interface which is a part common to the second part of the old input graph and the part of the old output graph, the second rewriting rule corresponding to logical operations which are computed based on the old input graph and the old output graph, and (b) testing that the rewriting rule and the second rewriting rule are commutative before applying the rewriting rule to the old output graph.
2. The method of claim 1 , wherein the method further comprises: (a) computing a second rewriting rule that specifies: (i) a second part of the old input graph to be replaced, (ii) a part of the old output graph to replace the second part of the old input graph, and (iii) a second interface which is a part common to the second part of the old input graph and the part of the old output graph, the second rewriting rule corresponding to logical operations which are computed based on the old input graph and the old output graph, and (b) testing that the rewriting rule and the second rewriting rule are commutative before applying the rewriting rule to the old output graph. 8. The method of claim 2 , wherein the method further comprises testing for 3D compatibility between a volume corresponding to the part of the new input graph and a volume corresponding to the part of the old output graph.