Re: Looking for an algorithm - calculate ingredients for a set of recipes

2017-09-25 Thread Paul Moore
On 25 September 2017 at 15:20, Paul Moore wrote: > On 25 September 2017 at 14:23, Ian Kelly 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 exact

Re: Looking for an algorithm - calculate ingredients for a set of recipes

2017-09-25 Thread Paul Moore
On 25 September 2017 at 14:23, Ian Kelly 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 worr

Re: Looking for an algorithm - calculate ingredients for a set of recipes

2017-09-25 Thread Ian Kelly
On Mon, Sep 25, 2017 at 6:49 AM, Paul Moore wrote: > I'm trying to work out a good algorithm to code a calculation I need > to do. I can see brute force ways of handling the problem, but I keep > getting bogged down in details, and the question seems like it's > something that should have been sol

Looking for an algorithm - calculate ingredients for a set of recipes

2017-09-25 Thread Paul Moore
I'm trying to work out a good algorithm to code a calculation I need to do. I can see brute force ways of handling the problem, but I keep getting bogged down in details, and the question seems like it's something that should have been solved plenty of times in the past, I just don't know where to