def is_independent_set(G, nodes):
 return (G.subgraph(nodes).number_of_edges() == 0)

def is_independent_set ( G , nodes ) : return ( G . subgraph ( nodes ) . number_of_edges ( ) == 0 )
returns true if and only if nodes is a clique in g .