I am currently working on an AI for playing the game Dots (link). The objective is to remove as many dots as possible by connecting similarly colored dots with a line. I've gone through the board and grouped each set of neighboring dots with the same color. The groups all currently share the same highlight color (black). So, for example, the four red dots in the top left form a single group, as do the three yellow dots on the top right.
I need to calculate every possible path through one of these groups. Can anyone think of a good algorithm? How could I avoid creating duplicate paths?
I've heard that a slightly modified DFS would be good in this situation. However, the paths are allowed to cross at nodes, but cannot reuse edges. How can I modify DFS accordingly?