Yes, doing this reordering requires building the graph of transformations as mentioned above, and somehow distinguishing nodes which represent complete / source objects and then finding the (shortest) path between source and final ones. This at least requires configuring what items are considered edge ones - it can't be determined from the graph alone, because there are multiple loops (like recycling the blade back to stocks etc.).