Let me explain the problem in its simplest form.
I have a rule for block replacement (block1 → block2), and given a model I would like to generate all possible variations applying this rule.
So what I would like to do is I find all occurences of block1 in the model graph and keep some sort of
reference to the nodes, then I iterate over the binary selection block1/block2 of combinations available and modify the graph accordingly (keep block1 occurence vs delete block1 occurence and insert block2).
The problem is that the graph is modified in place, and I am using memory references to nodes, so after the first iteration I deleted an occurence of block1 I won’t be able to access the node again.
It would be nice if I could modify a copy of the graph, but if I make a copy I loose track of the occurences in the new graph (because of the use of references).
Anyone has a better idea for this?