If an algorithm fails in one way there is an alternative algorithm which might work. That alternative uses some of the intermediate values. But starting the new algorithm when the old one fails is tricky. The intermediate values no longer exist. So they have to start over from scratch and recreate them.
Every node represents a transformation of the data, every edge represents an intermediate state.
Nodes can have several edges leaving them, some that represent failure states. We create classes that represent the nodes. They have DO and UNDO functions. We create an algorithm manager that walks the graph of edges and nodes, calling the DO functions and watching for errors. If an error occurs, the managers calls UNDO walking backwards until the data is at a state where a different algorithm can be applied.