title: Implementing some variation of Bron–Kerbosch algorithm in python
body: <p>for a college project I'm trying to implement <a href="https://i.stack.imgur.com/sM9LC.jpg" rel="nofollow noreferrer">that algorithm</a>, but my code doesn't print all the answers after testing. For example for <code>graph = [[0, 0, 0, 1, 1, 1],[0, 0, 0, 1, 1, 1],[0, 0, 0, 1, 1, 1],[1, 1, 1, 0, 0, 0],[1, 1, 1, 0, 0, 0],[1, 1, 1, 0, 0, 0]]</code> he show's:</p>
  <pre><code>Clique found: [1, 4]
  Clique found: [1, 5]
  Clique found: [1, 6]
  Clique found: [2, 4]
  Clique found: [2, 5]
  Clique found: [2, 6]
  Clique found: [4, 3]
  Clique found: [6, 3]
  </code></pre>
  <p>but correct answer is (he forgot about [3,5]):</p>
  <pre><code>[1, 4]
  [1, 5]
  [1, 6]
  [2, 4]
  [2, 5]
  [2, 6]
  [3, 4]
  [3, 5]
  [3, 6]
  </code></pre>
  <p>my code so far is :</p>
  <pre class="lang-py prettyprint-override"><code>def Clique(N, D, Z):
      if not any((N, D)):
          file_S = []
          for i in range(len(S)):
              file_S.append(S[i] + 1)
          print('Clique found: ' + str(file_S))
      elif N:
          for x in N:
              View(N, D, x)
              if Z is not None and x in Z:
                  Z.remove(x)
              Z_adj = Adj(x, graph)
              for i in range(len(Z_adj)):
                  if Z is not None and Z_adj[i] in Z:
                      Z.remove(Z_adj[i])
              while Z:
                  v = Z[0]
                  View(N, D, v)
                  if v in Z:
                      Z = Z.remove(v)
  
  def View(N, D, v):
      if v in N:
          N.remove(v)
      S.append(v)
      N_v = Adj(v, graph)
      D_v = Adj(v, graph)
      N_adj = list(set(N) &amp; set(N_v))
      D_adj = list(set(D) &amp; set(D_v))
      Clique(N_adj, D_adj, N_adj)
      S.remove(v)
      D.append(v)
  
  def Adj(v, X):
      return [i for i, n_v in enumerate(X[v]) if n_v]
  
  graph = [[0, 0, 0, 1, 1, 1],[0, 0, 0, 1, 1, 1],[0, 0, 0, 1, 1, 1],[1, 1, 1, 0, 0, 0],[1, 1, 1, 0, 0, 0],[1, 1, 1, 0, 0, 0]]
  
  
  X = []
  for i in range(len(graph)):
      X.append(i)
  S = []
  N = X.copy()
  D = []
  Z = X.copy()
  Clique(N, D, Z)
  
  </code></pre>
  <p>Any help why I'm getting only a part of the answer ?</p>