repeating calculations for subgraphes