Presentation is loading. Please wait.

Presentation is loading. Please wait.

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

Similar presentations


Presentation on theme: "2010-03-29 851-0585-04L – Modelling and Simulating Social Systems with MATLAB Lesson 6 – Graphs (Networks) Anders Johansson and Wenjian Yu (with S. Lozano."— Presentation transcript:

1 2010-03-29 851-0585-04L – 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 |

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

3 2010-03-29 A. Johansson & W. Yu / andersj@ethz.ch yuwen@ethz.ch 3 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

4 2010-03-29 A. Johansson & W. Yu / andersj@ethz.ch yuwen@ethz.ch 4 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?

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

6 2010-03-29 A. Johansson & W. Yu / andersj@ethz.ch yuwen@ethz.ch 6 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) Source: Batagelj

7 2010-03-29 A. Johansson & W. Yu / andersj@ethz.ch yuwen@ethz.ch 7 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.

8 2010-03-29 A. Johansson & W. Yu / andersj@ethz.ch yuwen@ethz.ch 8 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. PageRank).  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.

9 2010-03-29 A. Johansson & W. Yu / andersj@ethz.ch yuwen@ethz.ch 9 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

10 2010-03-29 A. Johansson & W. Yu / andersj@ethz.ch yuwen@ethz.ch 10 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.

11 2010-03-29 A. Johansson & W. Yu / andersj@ethz.ch yuwen@ethz.ch 11 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.http://oracleofbacon.org/  It can also be used to find the shortest path between any two actors.

12 2010-03-29 A. Johansson & W. Yu / andersj@ethz.ch yuwen@ethz.ch 12 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; …

13 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 times for the SBB network it looks like this: 1 3 2 4 Geneva Basel Bern Zurich

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

15 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 times for the SBB network it looks like this: 1 3 2 4 Geneva Bern Basel Zurich 0:57 0:54 0:55 1:41

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

17 2010-03-29 A. Johansson & W. Yu / andersj@ethz.ch yuwen@ethz.ch 17 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.


Download ppt "2010-03-29 851-0585-04L – Modelling and Simulating Social Systems with MATLAB Lesson 6 – Graphs (Networks) Anders Johansson and Wenjian Yu (with S. Lozano."

Similar presentations


Ads by Google