EXPERIMENTS IN SOCIAL INFLUENCE

In [1]:
from IPython.display import Image
%matplotlib inline
/usr/lib/sagemath/local/lib/python2.7/site-packages/setuptools-12.4-py2.7.egg/pkg_resources/__init__.py:1224: UserWarning: /home/mab/.sage//.python-eggs is writable by group/others and vulnerable to attack when used with get_resource_filename. Consider a more secure location (set with .set_extraction_path or the PYTHON_EGG_CACHE environment variable).
In [2]:
%load_ext sage
In [3]:
from influence import influence_sim,infdif_sim,polinfluence_sim,cl_influence_sim
In [4]:
# Connected Erdos-Renyi random graph

nodes = 25
p = 0.2
iterations = 500
In [5]:
# Experiment B1: INFLUENCE 

# Susceptibility of all nodes (low)
sa = 0.1
influence_sim(nodes,p,sa,iterations)
In [6]:
# Experiment B2: INFLUENCE 

# Susceptibility of all nodes (high)
sa = 0.9
influence_sim(nodes,p,sa,iterations)
In [7]:
# Experiment B3: INFLUENCE 
# DIFFUSION BY INFLUENCE with heterogeneous susceptibilities

# Susceptibility of node 0 (the lowest)
sa = 0.
# Susceptibility of all other nodes (very low)
sb = 0.1
infdif_sim(nodes,p,sa,sb,iterations)