Trimmed subgraph calculation