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 alg
Python is getting confused because you are modifying the list that it is iterating over.
Change
for vertex in p:
to
for vertex in p[:]:
this will cause it to iterate over a copy of p instead.
You can read more about this at http://effbot.org/zone/python-list.htm.