I'll do my best to explain what the algorithm is supposed to do:
There's a class 'Recipe'. Each Recipe can include other Recipes but cannot include itself or any other Recipe that includes it.
So, a simple example is we have just two Recipes A & B.
If A adds B first, then later on B cannot add A because it will cause a loop.
A more complicated example is:
A,B,C
(1) Recipe C Adds B
(2) Recipe B Adds A
(3) Recipe A attempts to add C, but can't because of the relationship. C - B - A.
I can do this myself, I just wondered if this was a standard named algorithm and I could grab the optimal solution.
Thanks