851 0585 04 L Modelling and Simulating Social

  • Slides: 17
Download presentation
851 -0585 -04 L – Modelling and Simulating Social Systems with MATLAB Lesson 6

851 -0585 -04 L – Modelling and Simulating Social Systems with MATLAB Lesson 6 – Graphs (Networks) Anders Johansson and Wenjian Yu (with S. Lozano and S. Wehrli) © ETH Zürich | 2010 -03 -29

Lesson 6 – Contents § History: Seven Bridges of Königsberg § Definition of graph

Lesson 6 – Contents § History: Seven Bridges of Königsberg § Definition of graph § Properties of graphs § Examples of graphs § MATLAB implementation of graphs 2010 -03 -29 A. Johansson & W. Yu / andersj@ethz. ch yuwen@ethz. ch 2

Space There are different ways to model the space in which social interaction takes

Space There are different ways to model the space in which social interaction takes place, e. g. : § No space, e. g. Dynamical Systems § Discrete space, e. g. Cellular Automata § Continuous space (Next week) § Graphs 2010 -03 -29 A. Johansson & W. Yu / andersj@ethz. ch yuwen@ethz. ch 3

Seven Bridges of Königsberg § Graph Theory was born in 1736, when Euler posted

Seven Bridges of Königsberg § Graph Theory was born in 1736, when Euler posted the following problem: Is it possible to have a walk in the city of Königsberg, that crosses each of the seven bridges only once? 2010 -03 -29 A. Johansson & W. Yu / andersj@ethz. ch yuwen@ethz. ch 4

Seven Bridges of Königsberg (II) § In order to approach the problem, Euler represented

Seven Bridges of Königsberg (II) § In order to approach the problem, Euler represented the important information as a graph: Source: wikipedia. org 2010 -03 -29 A. Johansson & W. Yu / andersj@ethz. ch yuwen@ethz. ch 5

Definition of Graph A graph (sometimes called: Network) consists of two entities: § Node

Definition of Graph A graph (sometimes called: Network) consists of two entities: § Node N (or: vertex) § Link L: Edge: Undirected link § Arc: Directed link § The graph is defined as G = (N, L) 2010 -03 -29 Source: Batagelj A. Johansson & W. Yu / andersj@ethz. ch yuwen@ethz. ch 6

Properties of Links and Nodes § A link can either be a Boolean property

Properties of Links and Nodes § A link can either be a Boolean property (connection vs. no connection), or § encoded as a strength (distance, traveling time, etc. ) § § A node can also contain information. 2010 -03 -29 A. Johansson & W. Yu / andersj@ethz. ch yuwen@ethz. ch 7

Properties of Graphs § A node can be characterized by: Degree k: Number of

Properties of Graphs § A node can be characterized by: Degree k: Number of connections. § Importance: Degree, Betweenness centrality (number of paths through the node), Closeness, Eigenvector centrality (e. g. Page. Rank). § § A graph can be characterized by: Degree distribution P(k): Fraction of nodes with k connections. § Diameter: The longest of the shortest paths between all nodes in the graph. § 2010 -03 -29 A. Johansson & W. Yu / andersj@ethz. ch yuwen@ethz. ch 8

Degree Distribution § Graphs can be classified by their topology, by measuring the degree-distribution

Degree Distribution § Graphs can be classified by their topology, by measuring the degree-distribution function P(k), of the number of connections k per node: Random graph: P(k) = binomial distribution § Scale-free graph: P(k) = k-γ § Source: www. computerworld. com 2010 -03 -29 A. Johansson & W. Yu / andersj@ethz. ch yuwen@ethz. ch 9

The Small World Experiment § Graphs are useful for modeling social networks, disease spreading,

The Small World Experiment § Graphs are useful for modeling social networks, disease spreading, transportation, and so on … § One of the most famous graph studies is the Small World Experiment (S. Milgram), which shows that the minimum distance between any two persons in the world is almost never longer than through 5 friends. 2010 -03 -29 A. Johansson & W. Yu / andersj@ethz. ch yuwen@ethz. ch 10

Oracle of Bacon § There is a web page http: //oracleofbacon. org/ finding the

Oracle of Bacon § There is a web page http: //oracleofbacon. org/ finding the path from any actor at any time to the Hollywood actor Kevin Bacon. § It can also be used to find the shortest path between any two actors. 2010 -03 -29 A. Johansson & W. Yu / andersj@ethz. ch yuwen@ethz. ch 11

MATLAB Implementation § A graph can be implemented in MATLAB via its adjacency matrix,

MATLAB Implementation § A graph can be implemented in MATLAB via its adjacency matrix, i. e. an N x N matrix, defining how N nodes are connected to the other N-1 nodes: N = 10; A = zeros(N, N); A(1, 2) = 1; A(10, 4) = 1; … 2010 -03 -29 A. Johansson & W. Yu / andersj@ethz. ch yuwen@ethz. ch 12

Graphs § If the nodes are cities and the links define connections and travel

Graphs § If the nodes are cities and the links define connections and travel times for the SBB network it looks like this: Basel 2 3 Bern 1 Zurich 4 Geneva 2010 -03 -29 A. Johansson & W. Yu / andersj@ethz. ch yuwen@ethz. ch 13

Graphs § If the nodes are cities and the links define connections and travel

Graphs § If the nodes are cities and the links define connections and travel times for the SBB network it looks like this: Basel 1 2 3 Bern 4 Geneva 2010 -03 -29 1 Zurich A = 2 3 4 0 1 1 0 1 0 2 1 1 0 1 3 0 0 1 0 4 A = [0 1 1 0; 1 1 0 1; 0 0 1 0]; A. Johansson & W. Yu / andersj@ethz. ch yuwen@ethz. ch 14

Graphs § If the nodes are cities and the links define connections and travel

Graphs § If the nodes are cities and the links define connections and travel times for the SBB network it looks like this: Basel 2 0: 55 1: 41 3 Bern 0: 54 1 0: 57 Zurich 4 Geneva 2010 -03 -29 A. Johansson & W. Yu / andersj@ethz. ch yuwen@ethz. ch 15

Graphs § If the nodes are cities and the links define connections and travel

Graphs § If the nodes are cities and the links define connections and travel times for the SBB network it looks like this: Basel 1: 41 3 Bern 2 3 4 0: 54 0 54 57 - 1 1 0: 57 Zurich 54 0 55 - 2 57 55 0 101 3 - - 101 0 2 0: 55 1 A = 4 4 Geneva 2010 -03 -29 A. Johansson & W. Yu / andersj@ethz. ch yuwen@ethz. ch 16

Projects § From next week, Wenjian Yu will take over the course. Therefore, address

Projects § From next week, Wenjian Yu will take over the course. Therefore, address all future communication only to: yuwen@ethz. ch § Today, there are no exercises. Instead, you can work on your projects and we will supervise you. 2010 -03 -29 A. Johansson & W. Yu / andersj@ethz. ch yuwen@ethz. ch 17