On the group of a graph with respect to a subgraph