I am trying to plant a row in a garden. Certain plants are good for some plants and bad for others, and I am trying to find the best order of plants: most adjacent friends and no adjacent foes, as defined in this table(I have one of each):
Num Vegetable Friends Foes
1 Watermelon 7,4,3 8,6
2 Tomatoes 9,8,6,5,1 7
3 Sunflowers 7,6,11
4 Zucchini 9,7,3
5 Eggplant 9,6,2 7,10
6 Cucumbers 9,7,3 8,1
7 Corn 8,6,4,3,1 5,2
8 Cantaloup 7,4,3 6,1
9 Bell peppers 6,5,11,10,2
10 Swiss chard 2 5
11 Rhubarb 9,3
How do I find the arrangement? Sort them using an algorithm? The title was my best guess at the answer. I am trying to understand the thought process and the implementation.