851-0585-04l – modeling and simulating social systems ......(seminar thesis) handing in seminar...

33
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

Upload: others

Post on 31-Jul-2020

4 views

Category:

Documents


1 download

TRANSCRIPT

Page 1: 851-0585-04L – Modeling and Simulating Social Systems ......(seminar thesis) Handing in seminar thesis and giving a presentation Dynamical Systems (no-space) Cellular Automata (grid)

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

Page 2: 851-0585-04L – Modeling and Simulating Social Systems ......(seminar thesis) Handing in seminar thesis and giving a presentation Dynamical Systems (no-space) Cellular Automata (grid)

2012-11-05 K. Donnay & S. Balietti / [email protected] [email protected] 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

Page 3: 851-0585-04L – Modeling and Simulating Social Systems ......(seminar thesis) Handing in seminar thesis and giving a presentation Dynamical Systems (no-space) Cellular Automata (grid)

2012-11-05 K. Donnay & S. Balietti / [email protected] [email protected] 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

Page 4: 851-0585-04L – Modeling and Simulating Social Systems ......(seminar thesis) Handing in seminar thesis and giving a presentation Dynamical Systems (no-space) Cellular Automata (grid)

2012-11-05 K. Donnay & S. Balietti / [email protected] [email protected]

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

Page 5: 851-0585-04L – Modeling and Simulating Social Systems ......(seminar thesis) Handing in seminar thesis and giving a presentation Dynamical Systems (no-space) Cellular Automata (grid)

2012-11-05 K. Donnay & S. Balietti / [email protected] [email protected]

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

Page 6: 851-0585-04L – Modeling and Simulating Social Systems ......(seminar thesis) Handing in seminar thesis and giving a presentation Dynamical Systems (no-space) Cellular Automata (grid)

2012-11-05 K. Donnay & S. Balietti / [email protected] [email protected]

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

Page 7: 851-0585-04L – Modeling and Simulating Social Systems ......(seminar thesis) Handing in seminar thesis and giving a presentation Dynamical Systems (no-space) Cellular Automata (grid)

2012-11-05 K. Donnay & S. Balietti / [email protected] [email protected]

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.

Page 8: 851-0585-04L – Modeling and Simulating Social Systems ......(seminar thesis) Handing in seminar thesis and giving a presentation Dynamical Systems (no-space) Cellular Automata (grid)

2012-11-05 K. Donnay & S. Balietti / [email protected] [email protected]

Examples of different network topologies

8

Source: Wang (2003)

Page 9: 851-0585-04L – Modeling and Simulating Social Systems ......(seminar thesis) Handing in seminar thesis and giving a presentation Dynamical Systems (no-space) Cellular Automata (grid)

2012-11-05 K. Donnay & S. Balietti / [email protected] [email protected]

From a problem to a scientific answer  Observation:

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

9

Page 10: 851-0585-04L – Modeling and Simulating Social Systems ......(seminar thesis) Handing in seminar thesis and giving a presentation Dynamical Systems (no-space) Cellular Automata (grid)

2012-11-05 K. Donnay & S. Balietti / [email protected] [email protected]

From a problem to a scientific answer  Question:

  How easy is to be manipulated in a social network?

10

Vs.

Page 11: 851-0585-04L – Modeling and Simulating Social Systems ......(seminar thesis) Handing in seminar thesis and giving a presentation Dynamical Systems (no-space) Cellular Automata (grid)

2012-11-05 K. Donnay & S. Balietti / [email protected] [email protected]

From a problem to a scientific answer   Literature Review:

  Was the problem already treated?

11

Page 12: 851-0585-04L – Modeling and Simulating Social Systems ......(seminar thesis) Handing in seminar thesis and giving a presentation Dynamical Systems (no-space) Cellular Automata (grid)

2012-11-05 K. Donnay & S. Balietti / [email protected] [email protected]

From a problem to a scientific answer   Literature Review:

  How existing models can be improved?

12

?

Page 13: 851-0585-04L – Modeling and Simulating Social Systems ......(seminar thesis) Handing in seminar thesis and giving a presentation Dynamical Systems (no-space) Cellular Automata (grid)

2012-11-05 K. Donnay & S. Balietti / [email protected] [email protected]

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

Page 14: 851-0585-04L – Modeling and Simulating Social Systems ......(seminar thesis) Handing in seminar thesis and giving a presentation Dynamical Systems (no-space) Cellular Automata (grid)

2012-11-05 K. Donnay & S. Balietti / [email protected] [email protected]

From a problem to a scientific answer  Results

  Let us assume ‘informed’ agents   Let us consider networks

14

https://github.com/msssm/Informed_Agents

Page 15: 851-0585-04L – Modeling and Simulating Social Systems ......(seminar thesis) Handing in seminar thesis and giving a presentation Dynamical Systems (no-space) Cellular Automata (grid)

2012-11-05 K. Donnay & S. Balietti / [email protected] [email protected]

Generators  How to generate random, realistic graphs?

1.  Probabilistic generators

2.  Degree-based generators

3.  Process-based generators

15

Page 16: 851-0585-04L – Modeling and Simulating Social Systems ......(seminar thesis) Handing in seminar thesis and giving a presentation Dynamical Systems (no-space) Cellular Automata (grid)

2012-11-05 K. Donnay & S. Balietti / [email protected] [email protected]

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

Page 17: 851-0585-04L – Modeling and Simulating Social Systems ......(seminar thesis) Handing in seminar thesis and giving a presentation Dynamical Systems (no-space) Cellular Automata (grid)

2012-11-05 K. Donnay & S. Balietti / [email protected] [email protected]

Probabilistic Generators: Erdos-Renyi

  random graph – 100 nodes, avg degree = 2

  Fascinating properties (phase transition)

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

17

Page 18: 851-0585-04L – Modeling and Simulating Social Systems ......(seminar thesis) Handing in seminar thesis and giving a presentation Dynamical Systems (no-space) Cellular Automata (grid)

2012-11-05 K. Donnay & S. Balietti / [email protected] [email protected]

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

Page 19: 851-0585-04L – Modeling and Simulating Social Systems ......(seminar thesis) Handing in seminar thesis and giving a presentation Dynamical Systems (no-space) Cellular Automata (grid)

2012-11-05 K. Donnay & S. Balietti / [email protected] [email protected]

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

Page 20: 851-0585-04L – Modeling and Simulating Social Systems ......(seminar thesis) Handing in seminar thesis and giving a presentation Dynamical Systems (no-space) Cellular Automata (grid)

2012-11-05 K. Donnay & S. Balietti / [email protected] [email protected]

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

Page 21: 851-0585-04L – Modeling and Simulating Social Systems ......(seminar thesis) Handing in seminar thesis and giving a presentation Dynamical Systems (no-space) Cellular Automata (grid)

2012-11-05 K. Donnay & S. Balietti / [email protected] [email protected]

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

Page 22: 851-0585-04L – Modeling and Simulating Social Systems ......(seminar thesis) Handing in seminar thesis and giving a presentation Dynamical Systems (no-space) Cellular Automata (grid)

2012-11-05 K. Donnay & S. Balietti / [email protected] [email protected]

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

Page 23: 851-0585-04L – Modeling and Simulating Social Systems ......(seminar thesis) Handing in seminar thesis and giving a presentation Dynamical Systems (no-space) Cellular Automata (grid)

2012-11-05 K. Donnay & S. Balietti / [email protected] [email protected]

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

Page 24: 851-0585-04L – Modeling and Simulating Social Systems ......(seminar thesis) Handing in seminar thesis and giving a presentation Dynamical Systems (no-space) Cellular Automata (grid)

2012-11-05 K. Donnay & S. Balietti / [email protected] [email protected]

Get the lecture files from GitHub

  Lecture files are also available on a GitHub repository:

[email protected]:msssm/lectures_files.git

24

Page 25: 851-0585-04L – Modeling and Simulating Social Systems ......(seminar thesis) Handing in seminar thesis and giving a presentation Dynamical Systems (no-space) Cellular Automata (grid)

2012-11-05 K. Donnay & S. Balietti / [email protected] [email protected]

Get the lecture files from GitHub

git clone [email protected]: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:

Page 26: 851-0585-04L – Modeling and Simulating Social Systems ......(seminar thesis) Handing in seminar thesis and giving a presentation Dynamical Systems (no-space) Cellular Automata (grid)

2012-11-05 K. Donnay & S. Balietti / [email protected] [email protected]

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

Page 27: 851-0585-04L – Modeling and Simulating Social Systems ......(seminar thesis) Handing in seminar thesis and giving a presentation Dynamical Systems (no-space) Cellular Automata (grid)

2012-11-05 K. Donnay & S. Balietti / [email protected] [email protected]

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

Page 28: 851-0585-04L – Modeling and Simulating Social Systems ......(seminar thesis) Handing in seminar thesis and giving a presentation Dynamical Systems (no-space) Cellular Automata (grid)

2012-11-05 K. Donnay & S. Balietti / [email protected] [email protected]

R igraph  R and Matlab integration to plot nice

graphs (igraph library)

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

28

Page 29: 851-0585-04L – Modeling and Simulating Social Systems ......(seminar thesis) Handing in seminar thesis and giving a presentation Dynamical Systems (no-space) Cellular Automata (grid)

2012-11-05 K. Donnay & S. Balietti / [email protected] [email protected]

SOCNET Mailing List  Social Network Analysis Mailing List:

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

29

Page 30: 851-0585-04L – Modeling and Simulating Social Systems ......(seminar thesis) Handing in seminar thesis and giving a presentation Dynamical Systems (no-space) Cellular Automata (grid)

2012-11-05 K. Donnay & S. Balietti / [email protected] [email protected]

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

Page 31: 851-0585-04L – Modeling and Simulating Social Systems ......(seminar thesis) Handing in seminar thesis and giving a presentation Dynamical Systems (no-space) Cellular Automata (grid)

2012-11-05 K. Donnay & S. Balietti / [email protected] [email protected]

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

Page 32: 851-0585-04L – Modeling and Simulating Social Systems ......(seminar thesis) Handing in seminar thesis and giving a presentation Dynamical Systems (no-space) Cellular Automata (grid)

2012-11-05 K. Donnay & S. Balietti / [email protected] [email protected]

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

Page 33: 851-0585-04L – Modeling and Simulating Social Systems ......(seminar thesis) Handing in seminar thesis and giving a presentation Dynamical Systems (no-space) Cellular Automata (grid)

2012-11-05 K. Donnay & S. Balietti / [email protected] [email protected]

Projects   Today, there are no exercises. Instead,

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

33