for n1 in range(0, len(nodes)):
for n2 in range(n1 + 1, len(nodes)):
if not self.has_edge(nodes[n1], nodes[n2]):
return False
return True
After Change
Check if the all the nodes belong to a single clique in the graph
for node1, node2 in itertools.combinations(nodes, 2):
if not self.has_edge(node1, node2):
return False
return True