Warning

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

networkx.algorithms.clique.make_max_clique_graph

make_max_clique_graph(G, create_using=None)[source]

Returns the maximal clique graph of the given graph.

The nodes of the maximal clique graph of G are the cliques of G and an edge joins two cliques if the cliques are not disjoint.

Parameters
  • G (NetworkX graph)

  • create_using (NetworkX graph constructor, optional (default=nx.Graph)) – Graph type to create. If graph instance, then cleared before populated.

Returns

A graph whose nodes are the cliques of G and whose edges join two cliques if they are not disjoint.

Return type

NetworkX graph

Notes

This function behaves like the following code:

import networkx as nx
G = nx.make_clique_bipartite(G)
cliques = [v for v in G.nodes() if G.nodes[v]['bipartite'] == 0]
G = nx.bipartite.project(G, cliques)
G = nx.relabel_nodes(G, {-v: v - 1 for v in G})

It should be faster, though, since it skips all the intermediate steps.