O'Reilly logo

Complex Network Analysis in Python by Dmitry Zinoviev

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Perform Blockmodeling

The construction of the graph of maximal cliques or communities is a special case of blockmodeling—grouping network nodes according to some meaningful definition of equivalence and replacing them with synthetic “supernodes.” A more general function nx.quotient_graph(G,part,relabel=True) takes a graph G and its partition part as a list of node collections (lists or sets), and creates an induced graph. Unlike nx.make_max_clique_graph and community.induced_graph, nx.quotient_graph requires the partition includes every node in the original graph at most once. You can manually remove the offending overlapping clique from a clique partition, if you want:

 cliques = list(nx.find_cliques(G))
<= [['Golf', 'Hotel', 'Foxtrot'], ['Echo', ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required