Rewriting code using global and local vertex/edge identifiers