Binary Voter Model

A simulation to reproduce the original Binary Voter Model of Clifford and Sudbury 1973[1] and Holley and Liggett 1975[2].

Main.bvm.run_simFunction
function run_sim(n::Integer=20, p::Float64=0.2,
    influencer::Bool=false, replacement::Bool=false;
    verbose::Bool=true, make_plots::Bool=true, make_anim::Bool=false)

Run a single simulation of the Binary Voter Model on a randomly-generated graph. Continue until convergence (uniformity of opinion) is reached.

Arguments

  • n, p: Parameters to the Erdos-Renyi random graph model (n = number of nodes, p = probability of each pair of nodes being adjacent.)

  • influencer if true, makes the randomly selected node change the opinion of its randomly selected neighbor. If false, makes its randomly selected neighbor change the opinion of the randomly selected node

  • replacement: if true, puts back the last randomly selected node in the list of next nodes that can be selected. If false, takes out the last randomly selected node from the list of next nodes that can be selected.

  • verbose: if true, print output showing progress of simulation.

  • make_plots: if true, saves a time series plot of the simulation.

  • make_anim: if true, saves an animated gif of the simulation.

Returns

a tuple of values:

  • a status message (String)
  • a DataFrame of results with columns:
    • :iter: Iteration number
    • :frac_red: The fraction of nodes that had the Red opinion
source
Main.bvm.param_sweepFunction
function param_sweep(num_trials=10, this_n=20, this_p=0.2,
    influencer=false, replacement=false)

Run two entire parameter sweeps of simulations, one for varying values of n (number of nodes in random graph) and the other for varying values of p (edge probability). Plot output will be created in the files n_list_plot.svg and p_list_plot.svg.

Arguments

  • num_trials: the number of trials for each fixed combination of parameters.

  • make_anim: if true, saves an animated gif of the simulation.

  • this_n: value of n that will be constant as p is iterated.

  • this_p: value of p that will be constant as n is iterated.

  • influencer, replacement: passed to run_sim() (see notes there).

Returns

  • nothing
source
Main.bvm.conf_int_sweepFunction
function conf_int_sweep(num_trials=10, n=20, influencer=false,
    replacement=false)

Run a suite of simulations for varying values of p (probability of edge in random graph), and plot λ ($=N×p$) vs. num-iterations-to-converge with a 95% confidence band. The plot will be stored in sweepn.svg.

Arguments

  • num_trials: the number of trials for each value of p (and λ).

  • n: the number of nodes in the random graph.

  • influencer, replacement: passed to run_sim() (see notes there).

Returns

  • nothing
source

References

  • 1Clifford, P., & Sudbury, A. (1973). A Model for Spatial Conflict. Biometrika, 60(3), 581–588. https://doi.org/10.2307/2335008
  • 2Holley, R. A., & Liggett, T. M. (1975). Ergodic theorems for weakly interacting infinite systems and the voter model. The Annals of Probability, 643–663. http://dx.doi.org/10.1214/aop/1176996306