networkx 2.8.2 Pypi GitHub Homepage
Other Docs
NotesParametersReturns
enumerate_all_cliques(G)

This function returns an iterator over cliques, each of which is a list of nodes. The iteration is ordered by cardinality of the cliques: first all cliques of size one, then all cliques of size two, etc.

Notes

To obtain a list of all cliques, use :None:None:`list(enumerate_all_cliques(G))`. However, be aware that in the worst-case, the length of this list can be exponential in the number of nodes in the graph (for example, when the graph is the complete graph). This function avoids storing all cliques in memory by only keeping current candidate node lists in memory during its search.

The implementation is adapted from the algorithm by Zhang, et al. (2005) to output all cliques discovered.

This algorithm ignores self-loops and parallel edges, since cliques are not conventionally defined with such edges.

Parameters

G : NetworkX graph

An undirected graph.

Returns

iterator

An iterator over cliques, each of which is a list of nodes in G. The cliques are ordered according to size.

Returns all cliques in an undirected graph.

Examples

See :

Local connectivity graph

Hover to see nodes names; edges to Self not shown, Caped at 50 nodes.

Using a canvas is more power efficient and can get hundred of nodes ; but does not allow hyperlinks; , arrows or text (beyond on hover)

SVG is more flexible but power hungry; and does not scale well to 50 + nodes.

All aboves nodes referred to, (or are referred from) current nodes; Edges from Self to other have been omitted (or all nodes would be connected to the central node "self" which is not useful). Nodes are colored by the library they belong to, and scaled with the number of references pointing them


GitHub : /networkx/algorithms/clique.py#33
type: <class 'function'>
Commit: