Exercise

Visualizing retweet network

Visualizing retweets networks is an important exploratory data analysis step because it allows us to visually inspect the structure of the network, understand if there is any user that has disproportionate influence, and if there are different spheres of conversation.

A retweet network visualized with a force directed algorithm may look something like this.

Retweet network visualization

We are going to use a layout which runs quicker to see the plot, but the syntax is nearly the same.

networkx has been imported as nx, and the network has been loaded in G_rt for you.

Instructions

100 XP
  • Generate sizes with a list comprehension. Obtain the second item in x for all elements returned by the .degree() method.
  • Pass the network name as the first argument to nx.draw_networkx().
  • Pass the layout positions as the second argument to draw_networkx.
  • Pass the sizes list to node_size.