Documenti di Didattica
Documenti di Professioni
Documenti di Cultura
with MATLAB
Lecture 8 Introduction to Graphs/Networks
Olivia Woolley, Stefano Balietti, Lloyd Sanders, Dirk Helbing
Chair of Sociology, in particular of
Modeling and Simulation
ETH Zrich |
2015-11-09
21.09.
28.09.
05.10.
Modeling overview
12.10.
Flash Talks
19.10.
26.10.
Working on
projects
(seminar
thesis)
02.11.
09.11.
16.11.
Introduction to
social-science
modeling and
simulations
23.11.
30.12.
07.12.
14.12.
2015-11-09
2015-11-09
Source: wikipedia.org
2015-11-09
Definition of Graph
A graph consists of two entities:
Source: Batagelj
Nodes (vertices): N
Links: L
Edge: undirected link
Arc: directed link
The graph is defined as
G = (N,L)
2015-11-09
2015-11-09
2015-11-09
Graphs - examples
Friendship Network
[Moody 01]
2015-11-09
Food Web
[Martinez 91]
Protein Interactions
[genomebiology.com]
Graphs - Examples
NODES
LINKS
Protein interaction
Proteins
Metabolic reactions
Internet
Routers
Communication
channels
Social networks
Individuals
Social relations
WWW
Web pages
Hyperlinks
2015-11-09
Papers
Characterizing networks
1. Path properties
2. Node centrality measures and distributions
3. Local structure e.g. clustering
2015-11-09
10
Paths
Path of length n = ordered collection of
2015-11-09
11
is not connected
Connected
(Tree)
2015-11-09
Not Connected
(Forest)
Connected
with loops
12
Giant Component
The giant component connects the vast majority of the nodes
of a Graph.
2015-11-09
13
Shortest paths
The shortest path between i and j is minimum
number of traversed edges
A
J
H
D
X
J
H
D
X
14
2015-11-09
Centrality Measures
The importance of a node can be captured by:
Degree: number of connections
Flux or strength: Sum of strength of all
connections
16
17
Source: www.computerworld.com
2015-11-09
18
Source:
Wang (2003)
2015-11-09
19
21
2015-11-09
22
2015-11-09
23
2015-11-09
24
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;
2015-11-09
25
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
2015-11-09
26
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
4
Geneva
2015-11-09
1
Zurich
A =
A = [0 1 1 0; 1 0 1 0; 1 1 0 1; 0 0 1 0];
Modeling and Simulation of Social Systems with MATLAB
27
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
2015-11-09
28
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
1
0:54
1
0:57 Zurich
A =
54
57
54
55
57
55
101
101 0
4
Geneva
2015-11-09
29
1
Zurich
4
Geneva
2015-11-09
1
1
2
2
3
3
3
4
2
3
1
3
1
2
4
3
30
>>
>>
>>
1
Zurich >>
A
B
C
D
=
=
=
=
[2 3];
[1 3];
[1 2 4];
[3];
2015-11-09
31
54
57
54
55
57
55
101
101 0
2015-11-09
>>
>>
>>
>>
A
B
C
D
=
=
=
=
[2,54; 3,57];
[1,54; 3,55];
[1,57; 2,55; 4,101];
[3,101];
32
54
57
54
55
57
55
101
101 0
2015-11-09
33
Use them!!
2015-11-09
34
2015-11-09
35
2015-11-09
36
2015-11-09
References
Handbook of graphs and networks: from the Genome to the Internet,
2015-11-09
https://gephi.org/users/supported-graph-formats/csv-format/
https://gephi.org/users/
https://wiki.gephi.org/index.php/Datasets
Modeling and Simulation of Social Systems with MATLAB
38