node_clique_number

node_clique_number(G, nodes=None, cliques=None, separate_nodes=False)[source]

Returns the size of the largest maximal clique containing each given node.

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

Parameters
GNetworkX graph

An undirected graph.

cliqueslist, optional (default=None)

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

Returns
int or dict

If nodes is a single node, returns the size of the largest maximal clique in G containing that node. Otherwise return a dict keyed by node to the size of the largest maximal clique containing that node.

See also

find_cliques

find_cliques yields the maximal cliques of G. It accepts a nodes argument which restricts consideration to maximal cliques containing all the given nodes. The search for the cliques is optimized for nodes.