Warning

This documents an unmaintained version of NetworkX. Please upgrade to a maintained version and see the current NetworkX documentation.

networkx.algorithms.clique.graph_number_of_cliques

graph_number_of_cliques(G, cliques=None)[source]

Returns the number of maximal cliques in the graph.

Parameters
  • G (NetworkX graph) – An undirected graph.

  • cliques (list) – 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

The number of maximal cliques in G.

Return type

int

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.