I have played with this as a macro so far. But I am missing something. I have attached a starting place, with some example steps on how this process should roughly work.
thanks for the additional details. This looks like an exercise for the Alteryx course / program. Maybe you give it a first shot to go as far as possible and then fellow community members can help where you encounter a blockage?
1) one possible non-macro method may involve the Make Group Tool, Tile Tool and Join Tool.
2) this can also be solved via iterative macro. A possible schematics can be: starting with iteration 1 first assign any random food to group number nth with n being the number of iteration. Second, use Appropriate Join setting to find any other group that has at least one common ingredient with this group. Third, those foods that are found to have common ingredient are also assigned to group nth. Those that have no matching ingredients are loop back as input to the next iteration. Done till no more left over.
I got it to work. But I am sure there is more efficiency to be had. One particular problem I am having, I want to max a maximum amount of iterations, but find a way to prevent the data from continuing to run once I have already finalized all of the data. But I need the full table set for each run until is finalized. So I can't filter out rows as I go, it has to be the full table.