Search icon

Solve AME

SOLVE_AME_5  Solve and plot Approximate Master Equations, pair approximation, and mean-field equations for binary-state dynamics on networks, from [J.P. Gleeson, Physical Review Letters  107, 068701 (2011) and arXiv:1209.2983]. Download the Octave/MATLAB script files here. Please cite the paper if used in publications; comments and bug reports to

SOLVE_AME_5 (DEGREEDISTRIBUTION, DISTPARAMS, DYNAMICS, DYNAMICSPARAMS, RHO0, ENDTIME, PLOTFLAGS) solves the sets of ordinary differential equations specifying three approximation methods, given by equations (1) through (4) of [PRL, 107, 068701 (2011)]. The degree distribution of the (configuration model) network is specified by the arguments DEGREEDISTRIBUTION and DISTPARAMS, and the local dynamics at each node are determined by the settings of DYNAMICS and DYNAMICSPARAMS. RHO0 is the fraction of (randomly-chosen) nodes that are in the infected state at time t=0, and ENDTIME specifies the end time for the solvers. The output plots are controlled by the 2-element vector PLOTFLAGS: if PLOTFLAGS(1)=1 then a figure showing the fraction of infected nodes over time is produced; if PLOTFLAGS(2)=1 than a figure is generated showing the fraction of network edges that connect infected nodes to susceptible nodes.

Options for specifying the degree distribution of the network are as follows:

  • DEGREEDISTRIBUTION = ‘zRegular’, DISTPARAMS = [z] : Regular random graph (Bethe lattice) where every node has degree z.
  • DEGREEDISTRIBUTION = ‘PRG’, DISTPARAMS = [ Kmin, Kmax, z ] : Poisson degree distribution with parameter (mean degree) z for degrees between Kmin and Kmax (inclusive).
  • DEGREEDISTRIBUTION = ‘truncSFN’, DISTPARAMS = [ Kmin, Kmax, gamma ]: Truncated scale-free distribution with power-law exponent gamma for degrees between Kmin and Kmax (inclusive).

Options for specifying the dynamics are as follows:

  • DYNAMICS = ‘SIS’, DYNAMICSPARAMS = [ lambda , mu ] : Susceptible-infected-susceptible disease dynamics with transmission rate lambda and recovery rate mu. See Table I of [PRL, 107, 068701 (2011)].
  • DYNAMICS = ‘Voter’, DYNAMICSPARAMS = [ ] : Voter model, no parameters. See Table I of [PRL, 107, 068701 (2011)].
  • DYNAMICS = ‘Glauber’, DYNAMICSPARAMS = [ T , J ] : Glauber dynamics for Ising spin model with temperature T and interaction strength J. See Table I of [PRL, 107, 068701 (2011)].
  • DYNAMICS = ‘MajorityVote’, DYNAMICSPARAMS = [ Q ] : Majority-vote model with noise parameter Q. See Table I of [PRL, 107, 068701 (2011)].
  • DYNAMICS = ‘ThisFR’, DYNAMICSPARAMS is a two-row array : User-defined infection probabilities F(m) and recovery probabilities R(m) for the case of a z-regular random graph. The parameter DEGREEDISTRIBUTION must be set to ‘zRegular’, and DISTPARAMS set to [ z ]; then DYNAMICSPARAMS(1,m+1) gives F(m) for m=0 to z, and  DYNAMICSPARAMS(2,m+1) defines R(m) for m=0 to z.

To reproduce the theory curves in the figures from [PRL, 207, 068701 (2011)], use the following:

  • Fig. 1(a): solve_AME_5('zRegular',[3],'SIS',[1 1.4],0.01,80,[1 0])
  • Fig. 2(a): solve_AME_5('truncSFN',[3 20 -2.5],'Glauber',[0 1],0.4,8,[1 0])
  • Fig. 2(b): solve_AME_5('zRegular',[3],'Glauber',[0 1],0.4,25,[1 0])

To reproduce the theory curves in the figures in arXiv1209.2983 “Binary-state dynamics on complex networks: pair approximation and beyond”, use the following:

  • Fig. 2: solve_AME_5('truncSFN',[3 20 -2.5],'SIS',[1 0],0.01,3,[1 1])
  • Fig. 3: z=4; mv=0:z; FRv(1,:)=1-mv/z; FRv(2,:)=zeros(1,z+1); solve_AME_5('zRegular',[4],'ThisFR',FRv,0.01,30,[1 1])
  • Fig. 5: lambda=6; mu=3; solve_AME_5('zRegular',[3],'ThisFR',[1 lambda lambda^2 lambda^3; mu  mu mu mu],0.01,0.8,[1 1])
  • Fig. 6: solve_AME_5('PRG',[0 25 7],'Glauber',[2/log(2.5) 1],0.51,15,[1 1])
  • Fig. 7: solve_AME_5('zRegular',[3],'MajorityVote',[0.07],0.55,200,[1 1])
  • Fig. 8: solve_AME_5('zRegular',[5],'ThisFR',[0 0 1 1 1 1; 0 0 0 0 0 0],0.05,35,[1 1])