On 25 September 2017 at 14:23, Ian Kelly <ian.g.ke...@gmail.com> wrote: > You have a DAG, so you can sort it topologically. Then you can process > it in that order so that everything that uses X will be processed > before X so that when you get to X you'll know exactly how much of it > you need and you don't have to worry about "feedback". For actual > production, run through it in the opposite order so that you'll > produce all your precursors before the things that require them.
Hmm, yes that makes sense. I was thinking of a topological sort in the other direction (ingredient before product) and that way round doesn't work. For some reason, when thinking about topological sorts, I tend to get fixated on one direction and forget they are actually reversible... Paul -- https://mail.python.org/mailman/listinfo/python-list