Exercise

# In-degree centrality

Centrality is a measure of importance of a node to a network. There are many different types of centrality and each of them has slightly different meaning in Twitter networks. We are first focusing on degree centrality, since its calculation is straightforward and has an intuitive explanation.

For directed networks like Twitter, we need to be careful to distinguish between in-degree and out-degree centrality, especially in retweet networks. In-degree centrality for retweet networks signals users who are getting many retweets.

`networkx`

has been imported as `nx`

.
Also, the networks `G_rt`

and `G_reply`

and `column_names = ['screen_name', 'degree_centrality']`

have been loaded for you.

Instructions

**100 XP**

- Calculate in-degree centrality for the retweet network with
`nx.in_degree_centrality()`

and store it in`rt_centrality`

. - Do the same for the reply network and store it in
`reply_centrality`

. - Pass the items (i.e. the key-value tuples) of the reply centralities to the DataFrame constructor.
- Do the same for the reply network.