Antoine Bellanger

Developer, Designer, Quantum Physics lover.

Currently taking care of all Apple development at Biowatch. I'm also a WWDC17 and a RWDevCon 2018 Scholarship Recipient.

Follow me on Linkedin.

"Stalking Algorithm" (1)

Disclaimer : I created this project only to see the limits of Instagram API in the idea of building relationship trees, gathering data and using these.
I do not endorse stalking at all. Neither the idea of putting labels on persons because of their Instagram Followers or Subscriptions.

The idea

One night, I thought about all the contacts I had on Instagram, composed of all my friends from Switzerland and around the world and on how I could gather a huge amount of data with my 200 followers.

I wanted to see how I could map the different links my friends have with each other.

The original idea. (Personal Work, Neo4J)

Here is a conceptualized idea : I like L and I want to know which friends we have in common. Using my algorithm, I learn that we have a friend in common, E but also that my friend M knows P, a friend of her.

The data

On the paper, what I can get and I could use is :

  • Their followers
  • Their pictures
  • Locations they added on their pictures
  • The people tagged on their pictures

To illustrate this amount of data, the database with my 197 followers was composed of 20538 people and 27041 relationships. It took me over 30 minutes to download all the data and then plot it in the software.

The tools

To make my “stalking machine”, I simply used a Python Instagram API and Neo4J to make the graphs.

Gathering data

Step 1, let’s get some data. I like to say that the core of the app is the data. I had enough here.

Using my account, I got a list of my followers and then simply downloaded the followers of my followers. At that time, I had around 200 JSON files with the result from the repeated API calls I made.

At that moment, I was only focused into building the relationships. All the data that we could use for analysis would be downloaded after.

This was the first layer of the app. Now I needed to add it into Neo4J.

Plotting data

Although this part looks fairly straightforward, it required a lot of time to carefully think who was going to be a “Friend”, who was an “Acquaintance”, and the different types of relations.

The current version works as follows :

Me, I needed a center for the graph to build around.

My “Friends”, they follow me.

My “Acquaintances”, they follow my friends.

then the relations :

  • ‍Between Me and my “Friends (1. and 2.), we have a level-1 relationship. So I have 197 level-1.
  • ‍Between my “Friends” together (2. and 2.), I decided it was a level-2 relationship. That’s 1275 level-2.
  • Between my “Friends and “Acquaintances” (2. and 3.), it is a level-3 relationship. That’s 25569 level-3.

What's next ?

More data ! So I can go on with the algorithm which I need to decide what it will do. I have a few ideas.

About the Algorithm

I plan to release the algorithm as open source code, but not yet.

If you're interested in more now, just drop an email at