def number_of_cliques(G, nodes=None, cliques=None):
 if (cliques is None):
  cliques = list(find_cliques(G))
 if (nodes is None):
  nodes = list(G.nodes())
 if (not isinstance(nodes, list)):
  v = nodes
  numcliq = len([1 for c in cliques if (v in c)])
 else:
  numcliq = {}
  for v in nodes:
   numcliq[v] = len([1 for c in cliques if (v in c)])
 return numcliq

def number_of_cliques ( G , nodes = None , cliques = None ) : if ( cliques is None ) : cliques = list ( find_cliques ( G ) ) if ( nodes is None ) : nodes = list ( G . nodes ( ) ) if ( not isinstance ( nodes , list ) ) : v = nodes numcliq = len ( [ 1 for c in cliques if ( v in c ) ] ) else : numcliq = { } for v in nodes : numcliq [ v ] = len ( [ 1 for c in cliques if ( v in c ) ] ) return numcliq
returns the number of maximal cliques for each node .