The 13 x 29 Project — Visualizing How India Reacted to Decriminalization of Homosexuality

Ashris
Towards Data Science
10 min readSep 30, 2018

--

This write-up is a companion article to the 13x29 Project — best viewed on Desktop. The best way to go through the project is to first read the introductory parts of this article and then playing with the interactive website.

On 6th September 2018, India took a bold step into the future. The rule of the land outlawed parts of Section 377, thus decriminalizing consensual physical relationship between adults, irrespective of their gender.

Celebrations post Section 377 Vedict | Credits: REUTERS/Francis Mascarenhas

People weren’t celebrating the freedom to have sex. People were celebrating not having to spend every waking moment of their lives thinking they are criminals. It took 158 years, relentlessness of thousands of brave activists and the wisdom of five far-sighted judges for this verdict to materialize.

75% of the world today lives in a country where homosexuality is not a crime, thanks to this decision. Several other countries will look up to India to change their anti-gay laws, and India’s future Alan Turings and Tim Cooks won’t have to end their life to overcome shame. One would expect that such a historic verdict will receive a strong reaction from all walks of life.

Why so much silence?

For three days after the verdict, I was glued to my Twitter feed. My heart swelled reading the tweets and the retweets.

Rainbows and Pride splashed all over my Twitter feed. But then, I noticed something weird. All of the tweets I was seeing were people from the entertainment industry. I wasn’t seeing business people, political leaders or sportsmen who had anything to say about this verdict.

For example, when United States legalized same-sex marriages everywhere in their nation, this is how the White House celebrated.

I was dissapointed that the verdict was being tucked under the bed and not celebrated the way it should be.

Secondly, having followed some amount of Bollywood gossips (thanks Koffee with Karan), I knew who’s whose friend in the Bollywood circles. It seemed like a close group of ‘friends’ were only tweeting about the verdict while the other ‘groups’ were quiet. Network science suggests that lot of traits like smoking, obesity, voting patterns propagate through networks like diseases do. Can LGBTQ-open-mindedness also spread via networks? Do certain sub-networks exists in the groups which are more pro-LGBTQ than others?

This got the Sherlock in me excited. Is there a pattern to this? Who really did comment about the verdict and how did this response vary according to people’s profession?

Identifying 377 Suspects

Without hypothesing much, purely based on curiosity, I decided to analyse 13 different fields with 29 representative influencers from each field — a total of 377 individuals. The fields I initially planned to explore were Politics, Entertainment, Business and Sports. I then subdivided these fields to 13 groups as follows:

  1. Government — The Prime Minister, Cabinet Ministers and Union Ministers
  2. Opposition — Leaders from Congress, CPI-M, AAP
  3. States — Chief Ministers of the 29 States
  4. Faith — Religious leaders, organizations, activists
  5. Journalism — Journalists, Editors, Writers
  6. Law — Lawyers
  7. Sports — Cricketers, Olympics Medal Winners
  8. Bollywood — Folks from Hindi Film Industry
  9. Music — Singers
  10. Creativity — Choreographers, Fashion Designers, Writers, Music Directors
  11. YouTube — Popular on Indian YouTube
  12. Entrepreneurship —Startup Founders, VCs
  13. Forbes 30 Under 30 — Folks listed by Forbes’ 30 Under 30.

You can have a look at the people included in the sample set here: https://twitter.com/iashris/lists

I based my sampling on the number of followers — a proxy to measure a person’s influence. For people with similar followers, I picked people at random, which I admit doesn’t zero the sampling errors but still gives a big picture view.

What did they say?

I was interested in what people were talking around the time of the verdict, so I decided to choose my analysis window from midnight 5th September to midnight 7th Septmber — centered around the day of the verdict of 6th.

I used the Tweepy library to write a Python script that fetched all the tweets posted by these 377 individuals durig these three days. Twitter doesn’t have an API to access tweets between a date, so I wrote a script that recursively pushes back the start_date till the needed tweets are fetched. Along with the tweets, I also extracted the number of followers, their profile images, hashtags used and their retweets. I did a keyword analysis to separate the tweets into ‘targeted’ and ‘non_target’ — depending on whether the tweet contained hashtags or text with words like 377, pride, lgbt, supreme court or love is love.

A JSON file was obtained for every person with their tweets and hashtags

Networkifying the Groups

I was not only interested in who was saying what but also if there was some kind of connection between people saying similar things. For this, I had to know how do people in each group are connected to each other.

The data I was looking for was — who follows whom. Twitter provides this information through their show friendship API. I obtained the pairs of all possible combinations of people in a group and obtained their ‘friendship’ data.

CSV containing who-follows-whom data

Visualizing the Network and the Hotspots

Once I had the two parts available — the next step was to visualize it. The fun part begins! I used this amazing force directed algorithm library to trigger a physics based simulation which clusters together people who follow each other and isolates those who aren’t as conencted with others.

To indicate the ones who reacted to the Verdict — let’s call them ‘Reactors’ — I made them stand out from the rest by giving a rainbow label. The ones who did not react — let’s call them ‘Non Reactors’ — I made their thumbnails smaller and greyscaled.

Aannnd…. Drumrolls!

The Opposition Network

Every grey line means there is some conenction between profiles A and B — wither A follows B, B follows A or both follow each other. You can know exactly how the relation is by hovering over the image.

A purple line indicates both A and B follow each other. The blue/pink lines are uni-directional and indicate the direction with the arrow pointing towards the person who is followed. As a thumb rule, the most connected people occupy the centre of the force directed visualization — so Shashi Tharoor, INC Congress, Sanjay Nirupam seem to be the most connected people of this network.

Umm.. So What?

Good question. It’s pretty and all to look at, but how exactly does this help us? We need a way to compare how bonded together the Reactors are vs how bonded the non-Reactors are.

Clustering Coefficient

In graph theory, a clustering coefficient is a measure of the degree to which nodes in a graph tend to cluster together. There is a boring technical definition but I will break it down in simple terms.

Consider your friend circle. Let’s say I have 3 friends — Anurag, Prerna and Komolika.

All of your friends are friends with each other. Only Anurag and Prerna are friends with each other. You probably don’t want to introduce Komolika to Anurag and Prerna.

Your Friend Circle

Now, what is the total number of friendships that can exist in your network? Let’s see. Anurag — Komolika, Anurag — Prerna and Prerna — Komolika.

So three total possible friendships of which just one is actualised →Anurag and Prerna. So the Clustering Coefficient for your friend circle is 1/3 or 0.33.

Clustering Coefficient thus, simply is the ratio of number of friendship pairs among your friends to the total possible pairs.

CC = Number of actual friendships among your friends / Total Number of possible friendships (ⁿC₂)

If Komolika somehow insists to meet Anurag during Durga Pujo and a new friendship fosters, your CC would update to 2/3 (0.66).

Komolika gets to know Anurag

Anurag and Komolika spend time together and that causes Prerna to get mad at you for introducing Komolika to Anurag and thus she ends her friendship with you. Does this increase your Clustering Coefficient or decrease it?

Prerna caught up in the Kasauti of Life

This actually pushes up your CC to 1 because now all your (remaining) friends — Anurag and Komolika are friends with each other. So possible = 1, total = 1.

The CC for a network is defined to be the average of its individual nodes. In the last scenario after Prerna ends her friendship with you, can you calculate the average CC of your friend circle?

For you, the CC is 1.
For Komolika, the CC is 1 as well.
For Anurag, the CC is 0.33
For Prerna, the CC is 0 as she doesn’t even have two friends.

Hence, the average CC for your network is 2.33/4 = 0.583 = 58.3%

Analysis

With everything stitched together, the interface looked fine. In the sidebar to the right, there is CC computed for the whole network and for the Reactors and Non-Reactors. Tweets posted by the network about the verdict auto-load on the bottom of the screen.

For the Opposition Network, the average CC is 51.76% which is pretty high. The CC for the Verdict Reactors is even higher! 70% while the CC for Non-Reactors is 19%. This directly suggests that the Reactors are far well bonded than the Non-Reactors and it actually is a small tightly connected subset in the Opposition that actually supports the verdict.

Now that we know how to interpret the values, let’s have a glance at some categories in the final product.

1 Flower = 1 Wish

Every category is represented by a vase. For every person who had something positive to say about the verdict, there is a flower in the vase.

Results

The final results can be viewed here — Project 13 x 29. The project is best viewed on a Desktop or a tablet.

Journalism

The Journalism Network

Journalism is overflowing with wishes on the verdict with a whopping 25 people having something positive to say — indicated by the large bouquet in the vase.

Also notice how tightly connected this network is. The average CC is 55.3% but the CC for non-reactors is 0% indicating there is just no bonding between the non-Reactors. This indicates that the Journalism network is strongly liberal inclined, as opposed to something like the Government where I found pin drop silence and thus no flowers in the vase.

Summarizing

Here are the inferences I draw from the project:

  1. Reactions certainly do depend on professions. While fields like law and Journalism had almost 85% of people in the network expressing positive views, domains like the Government, the States and Sports had below 10% of the network react to the verdict. Profession does influence the views you have about the world.
  2. Not only does your profession matter but so does where in the professional network do you belong to. In general, Bollywood, Opposition, Law and Journalism have a smaller, more tightly connected sub-network inside the group which is more pro-LGBTQ than the rest.
  3. Less focused domains like Creativity, Forbes30Under30 which aren’t well defined but a conglomeration of people from different fields have the lowest Clustering Coefficients and thus there is no concrete network which is either LGBTQ-favoring or opposing.
  4. Entrepreneurship network actually has a close knitted network which did not respond to the verdict. It was the outliers of this group who showed any reaction.
  5. Surprisingly, many Faith leaders like the CEO of Swarajyamarg, Sadhguru, Sri Sri Ravi Shankar had positive things to say about the verdict. Faith was the only network where there were negative reactors to the verdict.

That’s all folks!

I have been fascinated by network science and I am undertaking practical projects to see what hidden patterns can networks shed light on. If you have ideas on exploring a certain social issue with the help of networks, do write to me. I’m always looking for awesome collaborations.

I’d like to dedicate this project to our lawyers Menaka Guruswamy, Arundhati Katju and Pritha Srikumar who represented 20 petitioners from different IITs in India which played a small part in this historic verdict. It was my privilege to be one of these 20 people.

I’ll leave you with this beautiful video made by Star Gold — Love comes in all colors. Love is Love.

Source Code?

If you liked my work, consider supporting my work by buying me a coffee. The website is hosted on Github — which means it is totally open sourced. Feel free to have a look at the code and let me know if you have questions.

--

--