number_of_cliques#

number_of_cliques(G, nodes=None, cliques=None)[source]#

Returns the number of maximal cliques for each node.

Deprecated since version 3.0: number_of_cliques is deprecated and will be removed in v3.2. Use the result of find_cliques directly to compute the number of cliques containing each node:

{n: sum(1 for c in nx.find_cliques(G) if n in c) for n in G}

Returns a single or list depending on input nodes. Optional list of cliques can be input if already computed.