graph_number_of_cliques#

graph_number_of_cliques(G, cliques=None)[source]#

Returns the number of maximal cliques in the graph.

Deprecated since version 3.0: graph_number_of_cliques is deprecated and will be removed in v3.2. The number of maximal cliques can be computed directly with:

sum(1 for _ in nx.find_cliques(G))
Parameters:
GNetworkX graph

An undirected graph.

cliqueslist

A list of cliques, each of which is itself a list of nodes. If not specified, the list of all cliques will be computed, as by find_cliques().

Returns:
int

The number of maximal cliques in G.

Notes

You should provide cliques if you have already computed the list of maximal cliques, in order to avoid an exponential time search for maximal cliques.