Introduction
Recently, the term "contact tracing" has become commonplace when discussing solutions for dealing with the COVID-19 pandemic. In a nutshell, whenever you’re near someone else who has the feature activated, your phone will receive a code from the other person’s device and keep it stored for a while – usually 14 days, as it can take up to that amount of time for symptoms to show.
If the person in question tests positive for the virus, the hospital or institution responsible for the tests will upload the person’s codes to a public list, which everyone’s phone has access to. If your phone finds a code in that list that it has stored locally, it means you’ve come into contact with someone who tested positive, and, therefore, you might be infected as well.
While this is an efficient solution, the process of tracking whether or not people have been in contact with each other can be done in many other ways, each of which may have its own advantages over contact tracing. In this post, we’ll be going over how and why social media can be an alternative to contact tracing, as well as creating a synthetic complex network as an example of what this approach would be like.
Complex Networks and Social Media
Networks consist of a series of nodes connected by edges. These edges represent relations between the nodes, which is why this model is often used when studying social networks.
The classification of a network depends on whether its structure is predictable, regular, and easily describable. Networks that present regular behavior are called simple networks while those that don’t are called Complex Networks.
How does this relate to social media as well as everything else I’ve said so far? You can create complex networks based on social media that represent the social structure of a certain community, which can then be used to predict how the virus may spread through that particular group.

For example, imagine a bot that goes through a user’s recent social media feed -say, the last 14 days – and keeps track of every time they have taken a picture with someone. If the user tagged the other people in the pictures, the bot recursively goes through those users’ profiles as well.
By the end of that process, what you end up with is a complex network where the nodes are the profiles the bot has gone through and an edge represents whether the nodes it connects have come into contact in the last 14 days.
Going Into Detail With a Synthetic Network
To analyze how creating a complex network like the one I’ve described could help us deal with the Covid-19 pandemic more efficiently, as well as to demonstrate the unique advantages it brings, we’ll be creating a synthetic complex network. You can follow along in this Google Colab notebook.
There are many random models for creating synthetic networks, but the one we’ll be using is the Holme-Kim model. It’s a model made specifically for studying social networks. The model has a few particularities. The first is the existence of people who are often at the center of attention and who have more contact with others, labeled celebrities or hubs. The second is that, in this model, there’s a chance that any two nodes to which a particular node is connected may become connected as well, forming a triangle – This represents the fact that your friends might know and interact with each other as well.
A synthetic network based around this model can be created in Python using the NetworkX library, a popular library for working with simple and complex networks. In the below example, we create a network with 100 nodes where by default a node interacts with 4 others and there’s a 10% chance of a triangle forming.
If we were to plot our resulting network using the nx.draw_network() method while making it so the node size is proportional to their number of connections, it would look like this.

Better Visualizing the Network
We can turn the above image into a better-looking Visualization using a program called Gephi. Since it’s a program that relies on a user interface, the process is not very easily described through text. If you’d like to learn more about this process, you can watch the below video.
Insights of Complex Networks
One of the factors that make complex networks useful for spotting potential COVID-19 cases is the fact that not only does it allow you to keep track of interactions between individuals, but it can also tell you who the most "central" individuals are.
What do I mean by that? The centrality of a node – in this case representing an individual – refers to how connected they are to the rest of the network in question. By extension, it also refers to how much they can affect the network, as they’re a hub that connects many parts that would otherwise be further apart.
What does that mean in our context? It means that the spread of the virus depends, among other factors, on who becomes infected. This is because people with a higher centrality have a much wider reach and can therefore contribute much more to the spread of the disease than a normal person could.
To demonstrate this, let’s run a small simulation. In the two figures below, the node in orange is the first victim of the network. For interaction, we’ll be assuming a 50% chance of catching COVID-19. After running the simulation in the same network and for the same amount of cycles while only changing the first victim, this is the result.


One of the goals of Social Network Analysis, one of the main fields in Complex Network Analysis (CNA) is to identify those central nodes. One of the premises of CNA is that the importance of a node depends on structural elements of the network, meaning it can be measured – I go into a little more detail on this subject in the notebook.
So, unlike contact tracing, where you only know you’re at risk after a person you’ve directly interacted with has tested positive. By using social media to form complex networks and understanding how they portray social relations, it’s possible to affirm the possibility of infection without the need for someone you’re in direct contact with to have taken the test.
Conclusion
To sum it all up, while contact tracing is a very viable method for dealing with the pandemic and spotting cases before symptoms manifest, there are other alternatives that shouldn’t be overlooked and there are more variables to how the virus spreads than meets the eye.
By using the tools and techniques of Complex Network Analysis with social media as a data source, which has given us access to unprecedented amounts of data on otherwise closed communities, it’s possible to make analyses that could help reduce the effect of the COVID-19 pandemic.
References
The tool I used for the visualization video:
NetworkX documentation: