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



Find and manipulate cliques of graphs.

Note that finding the largest clique of a graph has been shown to be an NP-complete problem; the algorithms here could take a long time to run.


enumerate_all_cliques(G) Returns all cliques in an undirected graph.
find_cliques(G) Search for all maximal cliques in a graph.
make_max_clique_graph(G[, create_using, name]) Create the maximal clique graph of a graph.
make_clique_bipartite(G[, fpos, ...]) Create a bipartite clique graph from a graph G.
graph_clique_number(G[, cliques]) Return the clique number (size of the largest clique) for G.
graph_number_of_cliques(G[, cliques]) Returns the number of maximal cliques in G.
node_clique_number(G[, nodes, cliques]) Returns the size of the largest maximal clique containing each given node.
number_of_cliques(G[, nodes, cliques]) Returns the number of maximal cliques for each node.
cliques_containing_node(G[, nodes, cliques]) Returns a list of cliques containing the given node.