ComeçarComece de graça

Creating reply network

Reply networks have a markedly different structure to retweet networks. While retweet networks often signal agreement, replies can signal discussion, deliberation, and disagreement. The network properties are the same, however: the network is directed, the source is the replier and the target is the user who is being replied to.

For this exercise we are going to create a reply network from a slightly different sample of State of the Union tweets. Those tweets have been loaded for you in sotu_replies.

Este exercício faz parte do curso

Analyzing Social Media Data in Python

Ver curso

Instruções do exercício

  • Create the reply network from a pandas edge list.
  • Use the user's screen name as the source argument.
  • Use the screen name being replied to as the target argument.
  • Ensure that the network is a directed graph in the create_using argument.

Exercício interativo prático

Experimente este exercício completando este código de exemplo.

# Import networkx
import networkx as nx

# Create reply network from edgelist
G_reply = ____.____(
    sotu_replies,
    ____ = ____,
    ____ = ____,
    ____ = ____)
    
# Print the number of nodes
print('Nodes in reply network:', len(G_reply.nodes()))

# Print the number of edges
print('Edges in reply network:', len(G_reply.edges()))
Editar e executar o código