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.
यह अभ्यास पाठ्यक्रम का हिस्सा है
Analyzing Social Media Data in Python
अभ्यास निर्देश
- Create the reply network from a pandas edge list.
- Use the user's screen name as the
sourceargument. - Use the screen name being replied to as the
targetargument. - Ensure that the network is a directed graph in the
create_usingargument.
इंटरैक्टिव व्यावहारिक अभ्यास
इस अभ्यास को इस नमूना कोड को पूरा करके आज़माएँ।
# 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()))