Visualization of networks related to the presidential debate.
By: Soumyadeep Basu
Tags: Data Analysis, 2020 Presidential Race, Assignment 2, Data Analytics, Data Visualization

“Visualization is daydreaming with a purpose.” -Bo Bennett

Visualization is nothing but storytelling with data [1]. Using our imagination with a blend of logic is what creates an engaging, informative and compelling story.

American presidential debates: [2]

Political debates amongst the main electoral contenders are an American tradition. With time, the debates are evolving but, their competitive essence did not alter and carries on to be a substantial portion of the United States presidential election procedure.

The American presidential debates can be traced back to 1858 between Abraham Lincoln and Stephen Douglas. Lincoln followed Douglas on his promotion route across the state where Douglas gave his personal statements in that location and Lincoln would do the same.

Lincoln and Douglas in their Famous Debates. Credit: https://www.smithsonianmag.com/

Throughout the years, the debates have developed significantly with radio debates in the year 1948, America’s first television debate in the year 1952 and the first countrywide aired debate in the year 1960 to the 21st Century where the internet came into play. The debates throughout the years have shown to be crucial for voters to take decisions about their candidates.

“The photograph of John F. Kennedy and Richard M. Nixon is from the debate held in Chicago on September 26, 1960, at the CBS studio. This was the first Presidential debate in history and it was televised, attracting 60% of American households with televisions.” Credit:https://americanhistory.si.edu/

In the 2008 presidential primary election, CNN held debates utilizing topics offered by the people through YouTube. Twitter which was introduced in 2008, offered a stage for public opinions and candidate promotions. Coming to the debates in 2020 which continue amid the global pandemic covid-19.

In the debates there are officially no winners, although they help influence the views of the voters. Investigators follow the impacts of the discussions on the voters’ minds by questioning regarding their views of the event.

This year’s first among the three presidential debates was held on September 29th and my curious mind wanted to have a sneak peak what impact the candidates had on the Twitterati’s by collecting and visualizing their tweets.

Preparing input data:

I collected data using the hashtag Debates2020 using the method as my previous post [3] and then manipulated it to formulate csv files that the data visualization software Gephi can use to build maps.

For visualization, two lists are needed- first is a list of nodes in the network (tweets or twitter account) and the second independently lists ‘edges’, or links among nodes (replies, retweets, quote-tweets, and mentions). Every edge, has a source node and a target node.

Gephi creates a visualization of the data from these complementary lists.

Observing the dataset:

The first objective is to study the dataset and check to see if the data collected has any duplicates. For my dataset collected, I did not have any duplicate rows. Neither did I remove any rows or cleaned the dataset for non ASCII characters since that would cause biasness towards the final result.

Extracting nodes and edges: [4]

Figure showing nodes and edges. Credit https://mathinsight.org/network_introduction

Nodes: Location

Edges: Path to travel to reach one location from another

Graph: Collection of nodes and edges.

Importing libraries and reading the csv file

An edge is the connections between two nodes. They can be directed or undirected.

Column names:

source - Source usernames.

target - Target usernames.

strength- the number of times in total each of the users retweeted to/responded to/mentioned the other

Edges file create

A node of a graph is an object that is linked with another by an edge.

Column names:

screen_name- usernames of the twitter users.

label- text columns for the users.

Nodes file create.

4684 nodes and 5363 edges were extracted.

Next, I imported this data to Gephi and to visualize the findings.

Building network visualization: [5]

Step 1: Initially when I imported the data, the network was in a disorderly manner.

Initial graph layout in Gephi

Step 2: Next, I changed the layout of the graph using ForceAtlas2.

Graph layout using ForceAtlas2

Step 3: After that, I measured the statistics of the network in Gephi’s statistics tab [6].

Screenshot of statistics of the network

Global Measures:

Network Density: Number of actual ties/Number of potential ties.

0(Low density) → 0.5 → 1(High density) = 0 Average node degree= (Number of edges)/(Number of nodes) = 1.145 Network Diameter: Of all the shortest path in a network, the length of the longest one is the network diameter. =3 Average Path Length: The average of all the shortest paths of all possible nodes in a network. =1.186

Positional Measures:

Degree Centrality: Calculated by number of nodes adjacent to a node. The more nodes adjacent to a node will make it more dominant.

In-degree and Out-degree distribution report generated from Gephi.

In-degree: Number of links coming in from a node.

Out-degree: Number of links going out from a node.

Degree distribution report generated from Gephi.

Degree: Sum of in-links/Sum of out-links. Eigenvector Centrality: Nodal influence relative to its neighbors. Is a large positive value since it depends on number of neighbors and also sometimes number of important neighbors i.e. it concerns neighbors connectivity Closeness Centrality: Sum of the length of the shortest paths between the node and all other nodes. It takes into consideration how easy it is to access all nodes i.e. shortest distance. Betweenness Centrality: Measure of centrality based on the shortest paths. It measures significance of the node while information moves.

Eigenvector, closeness and betweenness centrality reports generated from Gephi.

Local Measures:

Modularity: It is a measurement of structure which is used for optimization discover groups in a network. = 0.875

Modularity report generated from Gephi.

Step 4: Next, I enhance the appearance of the graph by changing:

a) Color of nodes and edges according to modularity class.

b) Size of node according to In-degree.

c) Label size according to Betweenness centrality.

After that, I make some minor adjustments by using the tuning feature in the layout tab to enhance the aesthetics of the visualization and preview the final results to analyze the findings.