851-0585-04L – Modeling and Simulating Social Systems ......(seminar thesis) Handing in seminar...

Preview:

Citation preview

2012-11-05 © ETH Zürich |

851-0585-04L – Modeling and Simulating Social Systems with MATLAB Lecture 7 – Simulations with Networks

© ETH Zürich |

Chair of Sociology, in particular of

Modeling and Simulation

Karsten Donnay and Stefano Balietti

2012-11-05 K. Donnay & S. Balietti / kdonnay@ethz.ch sbalietti@ethz.ch 2

Schedule of the course 24.09. 01.10. 08.10. 15.10. 22.10. 29.10. 05.11. 12.11. 19.11. 26.11. 03.12. 10.12. 17.12.

Introduction to MATLAB

Introduction to social-science modeling and simulations

Working on projects (seminar thesis)

Handing in seminar thesis and giving a presentation

2012-11-05 K. Donnay & S. Balietti / kdonnay@ethz.ch sbalietti@ethz.ch 3

Schedule of the course 24.09. 01.10. 08.10. 15.10. 22.10. 29.10. 05.11. 12.11. 19.11. 26.11. 03.12. 10.12. 17.12.

Introduction to MATLAB

Working on projects (seminar thesis)

Handing in seminar thesis and giving a presentation

Dynamical Systems (no-space) Cellular Automata (grid)

Networks (graphs)

Continuous Space (…)

Different ways of Representing space

2012-11-05 K. Donnay & S. Balietti / kdonnay@ethz.ch sbalietti@ethz.ch

Goals of Lecture 7: students will 1.  Consolidate knowledge acquired during lecture 6, through

brief repetition of the main points 2.  Translate a research question into a simple model of

simulation on networks 3.  Get a firm grasp in algorithms to generate different network

topologies 4.  Review a custom implementation of algorithms to efficiently:

  Generate different networks topologies

  Compute statistical properties

5.  Run a simple simulation of the emergence of giant component in a random network

4

2012-11-05 K. Donnay & S. Balietti / kdonnay@ethz.ch sbalietti@ethz.ch

Repetition: Definition of Graph A graph consists of two entities:

  Nodes (vertices): N

  Links: L Edge: undirected link Arc: directed link

The graph is defined as G = (N,L)

Source: Batagelj

5

2012-11-05 K. Donnay & S. Balietti / kdonnay@ethz.ch sbalietti@ethz.ch

Repetition: Networks Topologies

6

  Random:   Small average path length   Small clustering coefficient (in general)

  Small World:   Small average path length   High clustering coefficient

  Scale Free:   Slightly smaller average path length   Highest clustering coefficient

2012-11-05 K. Donnay & S. Balietti / kdonnay@ethz.ch sbalietti@ethz.ch

Repetition: Networks Topologies

7

  Random:   Small average path length   Small clustering coefficient (in general)

  Small World:   Small average path length   High clustering coefficient

  Scale Free:   Slightly smaller average path length   Highest clustering coefficient

Homegeneous (Exponential) Degree Distr.

Power Law Degree Distr.

2012-11-05 K. Donnay & S. Balietti / kdonnay@ethz.ch sbalietti@ethz.ch

Examples of different network topologies

8

Source: Wang (2003)

2012-11-05 K. Donnay & S. Balietti / kdonnay@ethz.ch sbalietti@ethz.ch

From a problem to a scientific answer  Observation:

  The role of social networks in shaping the public opinion is becoming increasingly more important

9

2012-11-05 K. Donnay & S. Balietti / kdonnay@ethz.ch sbalietti@ethz.ch

From a problem to a scientific answer  Question:

  How easy is to be manipulated in a social network?

10

Vs.

2012-11-05 K. Donnay & S. Balietti / kdonnay@ethz.ch sbalietti@ethz.ch

From a problem to a scientific answer   Literature Review:

  Was the problem already treated?

11

2012-11-05 K. Donnay & S. Balietti / kdonnay@ethz.ch sbalietti@ethz.ch

From a problem to a scientific answer   Literature Review:

  How existing models can be improved?

12

?

2012-11-05 K. Donnay & S. Balietti / kdonnay@ethz.ch sbalietti@ethz.ch

From a problem to a scientific answer  Creating a new model

  Let us assume ‘informed’ agents   Let us consider networks

  How easily can the opinion of other persons be drifted in online social netwrks?

13

https://github.com/msssm/Informed_Agents

2012-11-05 K. Donnay & S. Balietti / kdonnay@ethz.ch sbalietti@ethz.ch

From a problem to a scientific answer  Results

  Let us assume ‘informed’ agents   Let us consider networks

14

https://github.com/msssm/Informed_Agents

2012-11-05 K. Donnay & S. Balietti / kdonnay@ethz.ch sbalietti@ethz.ch

Generators  How to generate random, realistic graphs?

1.  Probabilistic generators

2.  Degree-based generators

3.  Process-based generators

15

2012-11-05 K. Donnay & S. Balietti / kdonnay@ethz.ch sbalietti@ethz.ch

Probabilistic Generators: Erdos-Renyi   Algorithm:

  Start with a number of nodes n (fully not connected)   Define probability of connection P   For all the possible couples of nodes a link is created

with probability P

  The average number of links is given by:   p*n*(n-1)/2

  The greater P the higher the average degree of the network

16

2012-11-05 K. Donnay & S. Balietti / kdonnay@ethz.ch sbalietti@ethz.ch

Probabilistic Generators: Erdos-Renyi

  random graph – 100 nodes, avg degree = 2

  Fascinating properties (phase transition)

  But: unrealistic (Poisson degree distribution != power law)

17

2012-11-05 K. Donnay & S. Balietti / kdonnay@ethz.ch sbalietti@ethz.ch

E-R model & Percolation

K

Pc

0

1 N->infty

K0

K = avg(k) Pc = Prob( there is a giant connected component)

  The formation of the Giant Component is not a smooth process.

  It emerge all of sudden when

p > 1/n

  This phenomenon is called 1st order phase-transition

18

2012-11-05 K. Donnay & S. Balietti / kdonnay@ethz.ch sbalietti@ethz.ch

Graphs: Laws and patterns   Are real graphs random?   If we look at the data the answer most of the

time is: NO!!

degree degree

count count

k k

19

2012-11-05 K. Donnay & S. Balietti / kdonnay@ethz.ch sbalietti@ethz.ch

Degree-based generators   Figure out the degree distribution (eg., ‘Zipf’)

  Assign degrees to nodes

  Put edges, so that they match the original degree distribution

20

2012-11-05 K. Donnay & S. Balietti / kdonnay@ethz.ch sbalietti@ethz.ch

Process-based: Preferential attachment   Algorithm:

  Start with a random connected graph   At each time step create a new node and attach it to

the others with probability:

  Ki = degree of node i

  That is: if a node has many links, it will get more in the future…

21

2012-11-05 K. Donnay & S. Balietti / kdonnay@ethz.ch sbalietti@ethz.ch

Process-based: Preferential attachment   Generates power-law tails (richer-get-richer)

  The degree distribution is a power law of the form: P(K) ~ k-3

22

2012-11-05 K. Donnay & S. Balietti / kdonnay@ethz.ch sbalietti@ethz.ch

Process-based: Preferential attachment   Generates power-law tails (richer-get-richer)

  The degree distribution is a power law of the form: P(K) ~ k-3

But still, it does not reproduce the property of shrinking diameter in real evolving networks…

23

2012-11-05 K. Donnay & S. Balietti / kdonnay@ethz.ch sbalietti@ethz.ch

Get the lecture files from GitHub

  Lecture files are also available on a GitHub repository:

  git@github.com:msssm/lectures_files.git

24

2012-11-05 K. Donnay & S. Balietti / kdonnay@ethz.ch sbalietti@ethz.ch

Get the lecture files from GitHub

git clone git@github.com:msssm/lectures_files.git

git pull

25

  If you have already uploaded your public key in GitHub (see live presentation),

 You can dowload the latest lecture files with the following command in GIT Bash

  to stay updated:

2012-11-05 K. Donnay & S. Balietti / kdonnay@ethz.ch sbalietti@ethz.ch

Lecture Files  Generate

  Random Networks   Small World Networks   Scale Free Networks

  Compute:   Average Path Length   Clustering Coefficient

  Export to file:   Parse an adjacency matrix and create an arc list   Write a cell array as a csv file

26

2012-11-05 K. Donnay & S. Balietti / kdonnay@ethz.ch sbalietti@ethz.ch

Lecture Files   Simulate the emergence of the giant component

in a random network (files online in .zip archive).   emergence.m   emergence_video.m   emergence_smooth.m

  See live demo.

27

2012-11-05 K. Donnay & S. Balietti / kdonnay@ethz.ch sbalietti@ethz.ch

R igraph  R and Matlab integration to plot nice

graphs (igraph library)

  https://github.com/tconring/Arabian-Spring

28

2012-11-05 K. Donnay & S. Balietti / kdonnay@ethz.ch sbalietti@ethz.ch

SOCNET Mailing List  Social Network Analysis Mailing List:

http://www.insna.org/pubs/socnet.html

29

2012-11-05 K. Donnay & S. Balietti / kdonnay@ethz.ch sbalietti@ethz.ch

Network Analysis Literacy Talk Tomorrow

  Why Pretty Woman is a good recommendation for somebody who loves Star Wars V. ?

  Prof. Katharina Zweig (Technical University Kaiserslautern, Germany)

  Tuesday, 13 Nov 2012, 11.00-12.00 ETH Zürich, Main Building, HG E 22

  http://www.sg.ethz.ch/

30

2012-11-05 K. Donnay & S. Balietti / kdonnay@ethz.ch sbalietti@ethz.ch

References   Jure Leskovec, Deepayan Chakrabarti, Jon M. Kleinberg, Christos

Faloutsos: Realistic, Mathematically Tractable Graph Generation and Evolution, Using Kronecker Multiplication. PKDD 2005: 133-145

  Xiao Fan Wang and Guanrong Chen Complex Networks: Small-World, Scale-Free and Beyond

  Damon Centola, The Spread of Behavior in an Online Social Network Experiment. Science, Vol. 329 no. 5996 pp. 1194-1197 (2010)

  Duncan J. Watts, Steven H. Strogatz, Collective dynamics of 'small-world' networks. Nature 393, 440-442 (4 June 1998)

  Laszlo Barabasi, Scale-Free Networks: A Decade and Beyond. cience 24 July 2009: Vol. 325 no. 5939

  Laszlo Barabasi web site: http://nd.edu/~alb/

31

2012-11-05 K. Donnay & S. Balietti / kdonnay@ethz.ch sbalietti@ethz.ch

References   About the KONY phenomenon:

  http://invisiblechildren.com/kony/   http://globalspin.blogs.time.com/2012/03/19/kony-2012-mobs-

takedowns-and-meltdowns-but-very-little-truth/?xid=newsletter-europe-weekly

  http://www.youtube.com/watch?v=Y4MnpzG5Sqc

32

2012-11-05 K. Donnay & S. Balietti / kdonnay@ethz.ch sbalietti@ethz.ch

Projects   Today, there are no exercises. Instead,

you can work on your projects and we will supervise you.

33

Recommended