transform_to_subgraph_ws function

Create a subgraph using a node or edge selection