1

I have a problem that I'm trying to solve, I want to implement a method that takes a clique and returns the largest clique that contains that clique. The method I'm working on is recursive and uses backtracking to accept or refuse solutions according to the clique definition. My problem is I don't want to use Bron-Kerbosch algorithm as I want only one parameter to be passed to the method. Here's a pesudo code for what I did:

public ArrayList<Integer> findClique(ArrayList<Integer> R)
{
      if(no more candidates)
      {
        return R;
      }
      else
      {
         for(int candidate = next candidate; candidate <nodesNmuber; node++)
         if(connected(R,candidate))
         {
            R.add(candidate);
            findClique(R);
         }
          printOutput(R);
          R.remove(candidate);
      }

}

Can you help me with ideas on how to choose the condition that breaks the recursion? I don't know how to keep the value of next candidate until the next loop without passing it in the method parameter !

Lisa
  • 3,121
  • 15
  • 53
  • 85

0 Answers0