Wednesday, November 11, 2015

Visualize Twitter Online Interactions in Social Network

Twitter users can mention or reply other Twitter users in each single tweet. Visualizing those online interactions on Twitter provide better understandings of human online behaviors, such as identifying who are the most important information source, and how information is transmitted online, and etc.

To visualize Twitter users online interactions, we have to extract tweets, and separate the mentioned/ replied users from the tweet texts. This Python script uses Twitter REST API  can extract mentioned/ replied users from tweets, and store the results in a CSV file. To maximize the usage of the REST API, the since_id and max_id are used to retrieve more tweets from a single Timeline.

Once the mentioned/ replied users are separated, we can use Networkx to create a network graph in which the mentioned/ replied users and the author of each single tweet are connected. This created network can be exported into Gephi for further visualization and analysis. A simple script is available here.

No comments:

Post a Comment