Web Fake News Simulator

The COVID-19 simulator that I described in a recent blog post is also able to simulate the propagation of fake news by social media on the web. A simulation begins when a stream of fake news is introduced into the real news on popular social media outlets. The news propagates like a virus epidemic through forwarding, reposting and retweeting. It reaches a peak when the stream stops and there are fewer repostings to influence and it eventually runs its course. Here is every tenth frame of a typical simulation.



The simulation involves quantities that I call postings. They behave like the agents in programming environments such as NetLogo. I am not an expert in agent-oriented computing, but it is certainly possible to develop such simulations using MATLAB.


The simple agents in this simulation move around a two-dimensional square web with constant individual velocities. Postings that are not entirely factual are known as fake news. They influence other postings when they come in close proximity. New legitimate postings are born and die at specified rates. Postings have an age measured in a fractional number of time steps. There are six types of postings.
  • New . Bright green. Legitimate news posted during the simulation.
  • Current . Green. Factual, still relevant.
  • Stale . Dark green. Old news, but still factual.
  • Fake . Magenta. Fake news. Infects real news when it gets too close.
  • Debunked . Magenta circle. Proved fake. No longer influential.
  • Removed . Postings removed from the web. Just counted.
The simulation is initiated when a stream of fake postings from a particular source begins. The simulation is terminated when the stream of fakes has been debunked and stops being reposted. A filter with an adjustable effectiveness divides your news feed into two halves. Many popular browsers have such filters.

Typical simulation.

The simulation in the animation runs for 268 time steps. The time is on the x-axis, while the changing number of postings is in the title. The stream enters from the upper right corner and rapidly spreads through the unfiltered news that you see. In this example the filter is only effective on about 50 percent of postings, so the complete news feed is contaminated. Here is the first frame. The are 100 legitimate postings that have not been infected and one fake new posting entering from the upper right corner. Here is a frame about halfway through at time 125. All five live types are present, and filter has had little effect. The total population has risen to 112, which is the maximum seen for this particular run. Here is the last frame. The stream has stopped and all the fake news has been debunked. This particular episode is over. The is still some current news that has not been affected and a handful of new postings.


Eight parameters are set by the control panel on the left and can be changed during a simulation.
  • infect . Time steps between postings of fake news.
  • birth . Birth rate of real news.
  • mortality . Mortality rate.
  • strength . Radius of effectiveness of fake news.
  • duration . Time steps before a fake posting is busted.
  • speed . Time steps between display updates.
  • filter . Effectiveness of fake news filter.

Infectious encounters

In this simulator strength is the radius of the effectiveness of fake news. When a fake posting passes within this distance of a legitimate one, the infection is passed on. The default strength of .03 is about twice the dot size.


The frame on the right shows the running count for each type of posting. The first five types are still on the web, and their total number is n, the current population.


At any time during the simulation, you can click on the plot button. A second figure window pops open with a graph like this one. It plots the census over the entire history of the simulation. The parameter values are shown in the title. This is the history for the simulation is the animation. You can see that the current news population decreases from 100 at time zero to around 10 when the episode is over. The number of both new postings and old postings never gets above 10 in this particular setting. The number of fake postings almost reaches 50 before dropping to zero to end the epidemic. About 60 postings are debunked and a roughly equal number are removed from the web.


The simulator will be available in Version 5.2 of Cleve_Lab, at this link, until I get something that is not itself fake news to replace it.

Published with MATLAB® R2019b

  • print


To leave a comment, please click here to sign in to your MathWorks Account or create a new one.