graph term rewriting