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

Analyze the Networks

The resulting graph G has 2,975 nodes and 3,162 edges. It is very sparse:

 print​(nx.density(G))
<= 0.0007147660678259198

It also has a lot of small connected components with two to four nodes, as shown in the figure. (You can call nx.connected_components(G) and measure the size and count of them on your own.)

images/CompleteProductNetwork.png

To keep the case simple, we consider only the largest component (the GCC). We sort all components of G by size, select the last one (the largest!), join the respective label lists into one with chain.from_iterable, and extract the subgraph induced by these nodes. We store the resulting subgraph in the variable called ...

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