Implementing Bron–Kerbosch algorithm in python
for a college project I'm trying to implement the Bron–Kerbosch algorithm , that is, listing all maximal cliques in a given graph. I'm trying to implement the first algorithm (without pivoting) , but my code doesn't yield all the answers after testing it on the Wikipedia's example , my code so far is : # dealing with a graph as list of lists graph = [[0,1,0,0,1,0],[1,0,1,0,1,0],[0,1,0,1,0,0],[0,0,1,0,1,1],[1,1,0,1,0,0],[0,0,0,1,0,0]] #function determines the neighbors of a given vertex def N(vertex): c = 0 l = [] for i in graph[vertex]: if i is 1 : l.append(c) c+=1 return l #the Bron-Kerbosch