implementation of transform method
constructor for subgraph transformation