1

The wikipedia pseudocode on BK clique finding with pivoting:

   BronKerbosch2(R,P,X):
   if P and X are both empty:
       report R as a maximal clique
   choose a pivot vertex u in P ⋃ X
   for each vertex v in P \ N(u):
       BronKerbosch2(R ⋃ {v}, P ⋂ N(v), X ⋂ N(v))
       P := P \ {v}
       X := X ⋃ {v}

I'm unclear on what happens with P union X is empty. Since u is undefined, does the function continue with N(u) as the empty set (i.e. it continues with for each vertex v in P), or does it return to the caller?

jda
  • 265
  • 2
  • 6

2 Answers2

2

P union X is empty if and only if both P and X are empty. This condition is checked in the line

if P and X are both empty:

Thus, if this condition fails, this means P or X or both are not empty. Thus, there must be at least one element in P union X.

To put it in other words: If P union X is empty, we report R as a maximal clique.

phimuemue
  • 34,669
  • 9
  • 84
  • 115
1

It doesn't matter what we choose for the value of u. Your assumption is that P union X is empty, which means that both P and X are empty. So lets ignore the value of u for a second and go to the next line, "for each vertex v in P \ N(u):". Since P is empty, then P \ N(u) will still be empty. So that for loop will be skipped no matter what. So if it makes you feel better you could put a return statement in there, but as its currently written its still going to stop the execution of the algorithm.

Jan 'splite' K.
  • 1,667
  • 2
  • 27
  • 34
Charles G
  • 11
  • 1