Netlogo and the God complex
I love Netlogo, ever since I discovered it a few years ago I keep coming back to it just to play around with what’s possible. Netlogo is a programming environment for building simulations. It allows you to create artificial worlds consisting of patches and turtles. You can think of these as simulated tiles on the ground and little people, respectively. You can then easily program the turtles to move around and/or interact with each other and the patches they come in contact with. The worlds you can build are limited only by your imagination and your ability to express the rules that you want in Netlogo code.
Here are some examples:
- spawn 1000 turtles and have them move randomly around the world. When 2 turtles meet, they can either breed or fight.
- create a population of ants foraging for food and laying pheromone trails that attract other ants to a food pile
- build a simulated social network and allow information to propagate through it (more on this later..)
Building Netlogo models lets me simulate interesting processes that I come across atwork, whilst at the same time satisfying my colossal desire for power and control which was first awakened by games like Powermonger and Black & White (ah, the 1990s…)
The examples I outlined above just scratch the surface, and if you install Netlogo there is a large library of examples which illustrate what can be achieved. The really cool thing about Netlogo models is that the actions and rules you code are limited only by your imagination, and seemingly simple rules can give rise to really interesting and unpredictable emergent behaviour.
Netlogo simulations have been used extensively to study models of, amongst other things,kicking rugby conversions, mousetrap triggering, and overcrowding in bars (see here for a more complete list). and pretty much anything else that is a complex system with many interacting parts. It’s useful to build such models because they give you good intuitions about how these systems work, and allow you to interact with them by changing things like population size and spending patterns and instantly seeing the effect of those changes.
Although it’s fun to build such models and watch them run (die, little minions!), the real power of Netlogo is in its ability to generate data for further analysis. Any running Netlogo model can produce live charts of any variable within the program, but you can also output time series data to a text file. We can get data about lots of repetitions for a particular model using different starting parameters – this allows us to do higher level analysis to figure out how the simulation performs under different conditions.
Netlogo and Loyalty Bay
Here at Loyalty Bay, we’ve built a product called Super Users. Basically it allows you to get a sense of how active your users are on social media just from an email address. It’s a simple way of looking for those users that are much more highly connected to other people on social networks like Facebook and Twitter. Why is this important? Because these Super Users are the key to getting knowledge about your brand or business spreading quickly. If you give a Super User a great experience, the benefits can be, well, super! But if they get bad vibes about you…. not so much 😉
I thought it would be really fun to build a Netlogo model that simulates the effect that highly-connected users have on the spread of information through a social network, so I did exactly that (download the code here). The model is quite simple in concept. First we build a network of individuals who are interconnected via links that allow them to transmit messages to each other. Here’s what the model looks like to begin with:
The view shows lots of little green “users”, all interconnected to some degree with links between them. The links will act as a mechanism for the users to share a message between themselves – you can think of this as being the sentiment that a user feels for your brand or product. There is also a single red user, who currently is the only person who knows about the message. When we set the model running, time passes in discrete chunks (called ticks), and at each tick the message can be spread from someone who knows it to any of their neighbours. Here’s what the model looks like after 40 ticks have passed:
This shows the basic “message spreading” mechanism in action. Over time the message moves through the population of people, until finally everyone has heard the message, and the whole screen is full of red people who’ve all heard your good/bad news!
So far, so what? The model shown above is a bit boring actually, since it was specified that every user should be on average as well-connected as every other user (in fact on average there are 5 connections per user). But we can also set the model up with Super Users – people who have above-average connectedness. Here’s an example:
Here we can see that the single red user is super-connected to about 20 other users, unlike all the rest of the users who have much lower numbers of connections.
So now that we have a model to play around with, what experiments can we run? Well, the model has a number of parameters that we can vary. I’ve chosen a representative spread of experimental values which ought to demonstrate how the model behaves:
|n.superusers||The number of super-connected users in the population||0, 1, 10|
|n.normal.links||The average number of links that each non-super user has with its neighbours||3, 5|
|n.superuser.links||The average number of links that each super user has with its neighbours||10, 15, 20|
|p.spread||The probability that at each tick, a user will pass the message onto each of its neighbours
(each neighbour is tested in turn with the same probability of transmission each time)
In order to get some data, we run the Netlogo model many times with a fixed population size of 750, each time using a different combination of the above parameter values (I did this using the awesome BehaviorSpace functionality). The output that we measure is the percentage of the population who have heard the message over time. The data is written out to a flat csv file, and finally analysed using R and the incomparable dplyr and ggplot2 packages (obligatory shout-out: Hadley Wickham is a Genius). And…here are the results:
The red lines show the % message spread with no super users, the green with 1 super user, and the blue with 10 super users. What I hope comes across from the above set of charts is that under most conditions, even the presence of a single super user (~0.1% of the total users) has a noticeable effect on the speed of message-spreading throughout the whole population. The biggest effect occurs when the normal users are not well connected (top row of mini-charts), but even when they are, there is still a significant improvement in message-spreading speed when super users are in the mix.
Obviously this is a simulated setup. Real-world social networks are far more noisy and messy than our nice little Netlogo model. But I think this simulation demonstrates nicely that even a small percentage of super-connected users in a network can have a measurable effect on the speed of message transmission. That’s food for thought when you’re considering how to interact with your userbase, however you do it. All users are created equal, but some are more equal than others. And if you feel like you might be a Super User, then all I can say is…
The Netlogo model in this blog post was inspired by / modified from Virus on a network © 2008 Uri Wilensky
Author: William Roberts
Founder and CEO of Loyalty Bay
Find me on: