Initial infrastructure for subgraph calculation