networkx.generators.community.ring_of_cliques

ring_of_cliques(num_cliques, clique_size)[source]

Defines a “ring of cliques” graph.

A ring of cliques graph is consisting of cliques, connected through single links. Each clique is a complete graph.

Parameters
  • num_cliques (int) – Number of cliques

  • clique_size (int) – Size of cliques

Returns

G – ring of cliques graph

Return type

NetworkX Graph

Raises

NetworkXError – If the number of cliques is lower than 2 or if the size of cliques is smaller than 2.

Examples

>>> G = nx.ring_of_cliques(8, 4)

Notes

The connected_caveman_graph graph removes a link from each clique to connect it with the next clique. Instead, the ring_of_cliques graph simply adds the link without removing any link from the cliques.