getSubMatrixForSubgraph function

Get the submatrix corresponding to a subgraph