implement subgraph committing with n steps