Social Network Analysis for #boycottMLB on Twitter
By: Tarek Kassab
Tags: Twitter, MLB, Politics, Network Science, Social Network Analysis

Social Network Analysis for #boycottMLB on Twitter

Using social network analysis to uncover the characteristics behind the Twitter trend, such as top influencers, active engagers, and more Tarek Kassab Jun 17·7 min read

Photo by Jeremy Zero on Unsplash

On Thursday, March 25, 2021, the Georgia GOP signed a bill that overhauled and increased the state’s legislative control over its election protocols.

The bill was controversial. One of the most significant pushbacks came from the Major League Baseball (MLB), which pulled the year’s All-Star Game from Atlanta, Georgia to Denver, Colorado. As a result, former President Donald Trump called on fans to boycott the MLB over its decision, citing that the company is interfering with politics and partaking in the “cancel culture”. Consequently, #boycottMLB became trending on Twitter, most notably between April 2 and April 4, 2021.

We used social network analysis, which is an application of network science on social networks, to analyze the Twitter trend.

Data Collection

Tweets that included boycottMLB and #boycottMLB were collected between April 5 and April 11 using Twitter’s free public API and the Twitter Streaming Importer plugin that is available on Gephi.

We obtained a full network consisting of 9,769 nodes and 19,692 edges. The network is directed and unweighted. Nodes included hashtags, usernames, symbols, tweets, links, and media. Tweets may be original, retweets, or quotes. Edges connect users or tweets to hashtags, symbols, other users, other tweets, or links.

Using multi-mode networks projection, we derived the user and hashtag networks from the full network. The user network is directed and unweighted. It is composed of 3,637 nodes and 6,161 edges. The hashtag network is undirected and unweighted. It is composed of 1,378 nodes and 8,898 edges.

Identifying the Top Influencers

We identified the top influencers in the user network using the eigenvector centrality.

@MLB is the top influencer

Unsurprisingly, the official MLB Twitter account was by far the top influencer in the user network, followed by a couple of entrepreneurs and businesses, such as Delta Airlines and Coca-Cola. The only media outlet present among the list of the top ten influencers is Breitbart, an American conservative far-right news outlet. Notably, Stacey Abrams and Brian Kemp were the only two politicians on the list. Stacey Abrams, a Democrat, is credited with boosting the voter turnout in favor of Biden in Georgia during the 2020 elections. Brian Kemp, a Republican, is currently serving as the Governor of Georgia.

The top ten influencers

Identifying the Top Active Engagers

The active engagers, defined as users that have a high out-degree but few to none in-degree, are important for the dissemination of information throughout the network; however, they are not considered influencers due to the lack of engagement from other users.

The top ten active engagers

Identifying the Users Who Control the Flow of Information

The user network’s density was calculated by dividing the actual connections by the potential connections. The resulting value is 0.00093, confirming that the network is largely sparse. This was further supported by the clustering coefficient, whose value is 0.00756. This phenomenon enables select users to control the flow of information. This was verified by examining the top users using betweenness centrality.

The top ten users based on betweenness centrality

We noticed several users with high betweenness that were not previously listed as top influencers nor top engagers.

Identifying the Dominating Emotion in the Tweets

SentiStrength with its default options was used to analyze the sentiment of all 3,980 tweets, which includes retweets and quotes. It is a lexicon-based sentiment analysis tool that is well suited for social web texts.

Distribution of tweets by sentiment score

Distribution of tweets by sentiment type

After using Python to visualize our data, we discovered that most tweets were classified as neutral, followed by negative, then positive. Although we might expect negative sentiment to be the dominating emotion, we suspect that neutral had a higher distribution due to many tweets posting only article links or media attachments. Using other sentiment analysis tools, such as VADER or TextBlob, might produce different results.

Performing Text Analysis on the Tweets

Text analysis was used to analyze the most frequently appeared words. Similarly, this was done using Python.

Top ten words in all tweets

Word cloud for all tweets

Word cloud for positive rated tweets

Word cloud for negative rated tweets

WORDij was used to generate a Pajek file to import and visualize the word network in Gephi.

A word network extracted from the collected tweets. Node size and hue correlate to degree value

Overview of the word network

Identifying the Top Hashtags

We used degree centrality to obtain the top hashtags that frequently appeared alongside #boycottMLB in the hashtag network.

Top 10 hashtags that occurred alongside #boycottMLB

Predictably, #boycottMLB was the most frequent hashtag in the network. #mlb and #georgia are directly related to the boycott campaign. #boycottcocacola, #boycottcocacolaco, and #boycottdeltaairlines were prominent due to criticism made by the CEOs of the two companies against the new bill. #biden refers to President Biden, who condemned the bill, and who was accused by Trump of winning by voter fraud. #cancelculture refers to the act of ostracism against an individual or entity due to unfavorable actions or opinions, which Trump accused MLB, Coca-cola, Delta Airlines, and other companies of partaking in.

Identifying Opinion Leaders in Clusters and Communities

We applied two hierarchical algorithms for clustering and community detection on the user network, respectively. The first is the Girvan Newman method, which clusters groups of nodes by iteratively removing the edges with the highest betweenness. The second is modularity based on the Louvain method, which groups nodes with similar neighbors to the same community.

Girvan Newman produced 590 clusters with a modularity value of 0.701. It removed around 1,000 edges in the process. Louvain algorithm produced 515 communities with a modularity value of 0.927.

Users grouped into clusters using Girvan Newman

Users grouped into communities using Louvain

We highlighted the opinion leaders for some of the top clusters and communities using degree and betweenness centrality.

Opinion leaders of some of the largest clusters

Opinion leaders of some of the largest communities

Computing the Similarity of the Users

We used the assortative degree to find the correlation between the users and their number of connections. We used the Python package NetworkX to obtain the degree assortative coefficient that is based on the Pearson correlation. We discovered that the degree assortative coefficient of the graph is -0.2, indicating a disassortative network.

Nodes with low degree connecting to a node with high degree

Computing the Distribution of Bots in the User Network

We used Botometer, a machine learning algorithm, to classify users as bots or not. It assigns scores based on 6 main classes: network, user, friends, temporal, content, and sentiment features. Using Botometer’s free public API, Twitter Developer’s API, and the Python package Tweepy, we classified every user in the network either as bots or not. Users are classified as bots if their bot score is greater than or equal to the conditional probability given by Botometer.

We discovered that 84.25% of users were classified as not bots, whereas 12.13% of users were classified as bots. The remaining 3.63% were unidentified due to either the user profile being set to private, the profile having insufficient data in its timeline to perform a proper analysis, or the user account had been deleted or suspended by Twitter.

The user network composed of non-bots (blue), bots (red), and unknown (green). Node size correlates to eigenvector value.

After observing the user network based on eigenvector and betweenness centrality, we discovered that bots played an insignificant role in the grand scheme of the network.

Future Work

Machine learning sentiment analysis tools can be used instead of lexicon-based tools since the former is unable to identify sarcasm and mockery statements. Network analysis techniques may provide different perspectives when classifying users as bots. Community detection can be compared with generated random networks to verify results. Ordered and unordered attributes can be chosen to analyze the similarities of the users based on measures besides degree. Twitter’s enterprise, premium, or academic track API can provide more accurate results, as Twitter’s free API returns a sample of the tweets based on a certain metric, compared to the full archive offered by its paid counterparts.