Some of the techniques require building chains that jump from one candidate to another, sometimes to different cells, sometimes to different candidates within the same cell.

The chain lengths can be anywhere between 4 and 30 nodes long, and the amount of possible chains that can be made is quite a large number.

My code is technically working and can find the chains I am looking for, but it can take 20 seconds to find a single useful chain sometimes.

Right now I am building the chains using nodes in a tree in a linked-list format, and using recursion to continue the chain. When a terminal node is found it is added to a list to be tested. Then it breaks the chain into smaller ones and tries them too.

The problem is that I am probably building chains more than once (because a chain is the the same both forwards and backwards), and I am not sure how I can eliminate redundancy.

Or maybe the problem is that I am using recursion and I should be using iteration, but I am not sure the best method to iterate with.

This is the recursive call within the function:

Code:
if (currNode.children.Count > 0)
        {
            for (int n = 0; n < currChildCount; n++)
            {//Contine recursion on chilren
                temp = currNode.children[n];
                BuildAIC(temp, temp.note, terminalNodes, !findStrongLink);
When the recursive loop finishes, I will have a list of all the terminal nodes which inherently link all the way back to their starting node.

I iterate through each cell on the Sudoku grid and each note in each cell and then check the terminal nodes like this:

Code:
foreach (Point p in UnsolvedCells)
        {
            foreach (int note in cells[p.Y, p.X].notes.ToList())
            {
                ancestor = new NodeAIC(p, note);
                BuildAIC(ancestor, note, terminalNodes, true);

                for (int n = 0; n < terminalNodes.Count; n++)
                {
                      /* Test Chains Here */
The recursive function is a void type, and the recursion exits when it cannot find any more links. This happens if A) there are no links to be found, or B) all possible links are already part of the current chain.

Can anyone give me some ideas?