Introduction to Network Theory Lecture 1
Manuel Sebastian Mariani URPP Social Networks
Network Theory and Analytics | 18.09.18 Outlook
L1: Introduction to Network Theory | 1. Outlook 1 Outlook
2 Introductory example
3 Basic Concepts
4 Representation
5 Network types
6 Simple network models
7 Exercise
L1: Introduction to Network Theory | 1. Outlook Introductory example
L1: Introduction to Network Theory | 2. Introductory example The bridges of Königsberg 5 XVIII Century Is there a trail that transverses each bridge exactly once?
Euler, 1736: Geometry is unimportant, only degree ma ers. First paper in the history of graph theory.
■ Nodes: landmasses; edges: bridges
■ The number of bridges touching every landmass must be even
■ Only start and end nodes might have odd degrees
■ It is not possible to make such a trail
L1: Introduction to Network Theory | 2. Introductory example The bridges of Königsberg 5 XVIII Century Is there a trail that transverses each bridge exactly once?
Euler, 1736: Geometry is unimportant, only degree ma ers. First paper in the history of graph theory.
■ Nodes: landmasses; edges: bridges
■ The number of bridges touching every landmass must be even
■ Only start and end nodes might have odd degrees
■ It is not possible to make such a trail
L1: Introduction to Network Theory | 2. Introductory example The bridges of Königsberg 5 XVIII Century Is there a trail that transverses each bridge exactly once?
Euler, 1736: Geometry is unimportant, only degree ma ers. First paper in the history of graph theory.
■ Nodes: landmasses; edges: bridges
■ The number of bridges touching every landmass must be even
■ Only start and end nodes might have odd degrees
■ It is not possible to make such a trail
L1: Introduction to Network Theory | 2. Introductory example The bridges of Königsberg 5 XVIII Century Is there a trail that transverses each bridge exactly once?
Euler, 1736: Geometry is unimportant, only degree ma ers. First paper in the history of graph theory.
■ Nodes: landmasses; edges: bridges
■ The number of bridges touching every landmass must be even
■ Only start and end nodes might have odd degrees
■ It is not possible to make such a trail
L1: Introduction to Network Theory | 2. Introductory example The bridges of Kaliningrad 6 XXI Century Nowadays it is possible to transverse exactly once each of the existing bridges
■ On the modern map of Kaliningrad:
■ Green bridges survived until today ■ Red bridges were destroyed in WWII ■ Blue bridges were built last Century
L1: Introduction to Network Theory | 2. Introductory example The bridges of Kaliningrad 6 XXI Century Nowadays it is possible to transverse exactly once each of the existing bridges
■ On the modern map of Kaliningrad:
■ Green bridges survived until today ■ Red bridges were destroyed in WWII ■ Blue bridges were built last Century
L1: Introduction to Network Theory | 2. Introductory example Applications of Graph theory 7
■ Computer Science - graphs themselves are the objects of interest
■ Social Sciences - connections between people in society
■ Electrical Engineering - designing circuit connections
■ Epidemiology - contagion process in connected society
■ Chemistry - graphs represent molecular structure
■ …
L1: Introduction to Network Theory | 2. Introductory example Applications of Graph theory 7
■ Computer Science - graphs themselves are the objects of interest
■ Social Sciences - connections between people in society
■ Electrical Engineering - designing circuit connections
■ Epidemiology - contagion process in connected society
■ Chemistry - graphs represent molecular structure
■ …
L1: Introduction to Network Theory | 2. Introductory example Applications of Graph theory 7
■ Computer Science - graphs themselves are the objects of interest
■ Social Sciences - connections between people in society
■ Electrical Engineering - designing circuit connections
■ Epidemiology - contagion process in connected society
■ Chemistry - graphs represent molecular structure
■ …
L1: Introduction to Network Theory | 2. Introductory example Applications of Graph theory 7
■ Computer Science - graphs themselves are the objects of interest
■ Social Sciences - connections between people in society
■ Electrical Engineering - designing circuit connections
■ Epidemiology - contagion process in connected society
■ Chemistry - graphs represent molecular structure
■ …
L1: Introduction to Network Theory | 2. Introductory example Applications of Graph theory 7
■ Computer Science - graphs themselves are the objects of interest
■ Social Sciences - connections between people in society
■ Electrical Engineering - designing circuit connections
■ Epidemiology - contagion process in connected society
■ Chemistry - graphs represent molecular structure
■ …
L1: Introduction to Network Theory | 2. Introductory example Basic Concepts
L1: Introduction to Network Theory | 3. Basic Concepts Nodes 9
■ Set of nodes is called V
■ Fundamental units of which graphs are formed
■ Have many names:
■ Nodes ■ Vertices ■ Points ■ Actors
■ Represent objects
■ Individuals ■ Websites ■ Geographical Locations ■ Banks ■ ...
■ Are usually featureless (but not always)
L1: Introduction to Network Theory | 3. Basic Concepts Nodes 9
■ Set of nodes is called V
■ Fundamental units of which graphs are formed
■ Have many names:
■ Nodes ■ Vertices ■ Points ■ Actors
■ Represent objects
■ Individuals ■ Websites ■ Geographical Locations ■ Banks ■ ...
■ Are usually featureless (but not always)
L1: Introduction to Network Theory | 3. Basic Concepts Edges 10
■ Set of edges is called E
■ Second fundamental unit
■ Have many names:
■ Edges ■ Arcs ■ Lines ■ Ties
■ Represent connections between objects:
■ Friendship / follower / subscriber ■ Web-link ■ Geographical approachability ■ Loan ■ ...
■ Might have features (e.g. weight, see below)
L1: Introduction to Network Theory | 3. Basic Concepts Edges 10
■ Set of edges is called E
■ Second fundamental unit
■ Have many names:
■ Edges ■ Arcs ■ Lines ■ Ties
■ Represent connections between objects:
■ Friendship / follower / subscriber ■ Web-link ■ Geographical approachability ■ Loan ■ ...
■ Might have features (e.g. weight, see below)
L1: Introduction to Network Theory | 3. Basic Concepts Graph 11
■ Graph is an ordered pair G = (V , E)
■ In networks, network size; In graph theory, order of the graph: |V |
■ In graph theory, size of the graph: |E
L1: Introduction to Network Theory | 3. Basic Concepts Graph 12
■ Graph is an ordered pair G = (V , E)
■ E consists of 2-element subsets of V
■ Vertices belonging to an edge are called ends or end vertices of the edge
■ Vertices connected by an edge are called neighbouring or adjacent.
■ Some vertices may not belong to any edge, but all edges belong to a pair of vertices
L1: Introduction to Network Theory | 3. Basic Concepts Graph 12
■ Graph is an ordered pair G = (V , E)
■ E consists of 2-element subsets of V
■ Vertices belonging to an edge are called ends or end vertices of the edge
■ Vertices connected by an edge are called neighbouring or adjacent.
■ Some vertices may not belong to any edge, but all edges belong to a pair of vertices
L1: Introduction to Network Theory | 3. Basic Concepts Graph 12
■ Graph is an ordered pair G = (V , E)
■ E consists of 2-element subsets of V
■ Vertices belonging to an edge are called ends or end vertices of the edge
■ Vertices connected by an edge are called neighbouring or adjacent.
■ Some vertices may not belong to any edge, but all edges belong to a pair of vertices
L1: Introduction to Network Theory | 3. Basic Concepts Graph 12
■ Graph is an ordered pair G = (V , E)
■ E consists of 2-element subsets of V
■ Vertices belonging to an edge are called ends or end vertices of the edge
■ Vertices connected by an edge are called neighbouring or adjacent.
■ Some vertices may not belong to any edge, but all edges belong to a pair of vertices
L1: Introduction to Network Theory | 3. Basic Concepts Graph 12
■ Graph is an ordered pair G = (V , E)
■ E consists of 2-element subsets of V
■ Vertices belonging to an edge are called ends or end vertices of the edge
■ Vertices connected by an edge are called neighbouring or adjacent.
■ Some vertices may not belong to any edge, but all edges belong to a pair of vertices
L1: Introduction to Network Theory | 3. Basic Concepts Graphs and networks 13
Graph A graph is the mathematical object formally defined above
Network A network is the representation of a real-world system. Nodes and links have a specific meaning within the context of the appli- cation. Also, they have a ributes
Graph theory versus network theory
■ Different research questions
■ Graph techniques can be used to analyse networks
■ All networks are graphs (but the opposite is not true)
L1: Introduction to Network Theory | 3. Basic Concepts Graphs and networks 13
Graph A graph is the mathematical object formally defined above
Network A network is the representation of a real-world system. Nodes and links have a specific meaning within the context of the appli- cation. Also, they have a ributes
Graph theory versus network theory
■ Different research questions
■ Graph techniques can be used to analyse networks
■ All networks are graphs (but the opposite is not true)
L1: Introduction to Network Theory | 3. Basic Concepts Graphs and networks 13
Graph A graph is the mathematical object formally defined above
Network A network is the representation of a real-world system. Nodes and links have a specific meaning within the context of the appli- cation. Also, they have a ributes
Graph theory versus network theory
■ Different research questions
■ Graph techniques can be used to analyse networks
■ All networks are graphs (but the opposite is not true)
L1: Introduction to Network Theory | 3. Basic Concepts Simplest graphs 14
Trivial graph has only one vertex
Null graph has no edges
L1: Introduction to Network Theory | 3. Basic Concepts Path 15
Path is an alternating sequence of nodes and edges, beginning at a node and ending at a node. Paths do not visit any point more than once
H-F-C-A-D is a path
L1: Introduction to Network Theory | 3. Basic Concepts Walk 16
Walk allows nodes to be visited more than once. Path is a special case of walk
H-F-C-A-F-D is a walk
L1: Introduction to Network Theory | 3. Basic Concepts Cycle 17
Cycle is a path that starts and ends in the same edge. Cycle is a special case of walk
H-F-C-A-D-G-H is a cycle
L1: Introduction to Network Theory | 3. Basic Concepts Connectivity 18
■ A node is reachable from another node if there exists a path of any length from one node to another.
■ A graph is connected if there exists a path of any length between any pair of nodes.
■ A connected component is a subgraph, in which all nodes are reachable from every other.
L1: Introduction to Network Theory | 3. Basic Concepts Representation
L1: Introduction to Network Theory | 4. Representation Adjacency matrix 20 { N 1 if there is an edge from i to j, A = {aij } = (1) i,j=1 0 otherwise
L1: Introduction to Network Theory | 4. Representation Edgelist 21
Note that this edgelist must said to be undirected, otherwise it is not full, and more edges must be added to the list, from target to sources.
L1: Introduction to Network Theory | 4. Representation Adjacency matrix vs. Edge list 22
Adjacency matrix Edge list Memory O(N2) O(E) Lookup specific edge Fast, O(1) Slow Iterate over all edges Slow, O(N2) Fast Find neighbours of a node Time O(N) Time O(E) Be er for Dense graphs Sparse graphs Adding new vertices Hard Easy Adding new edges O(1) O(1) or O(E)
L1: Introduction to Network Theory | 4. Representation Network types
L1: Introduction to Network Theory | 5. Network types Network types 24
1. By mode of nodes: 1.1 One mode 1.2 Two nodes 2. By direction of edges: 2.1 Directed 2.2 Undirected 3. By weights of edges: 3.1 Weighted 3.2 Unweighted Any combination is possible!
L1: Introduction to Network Theory | 5. Network types Network types 24
1. By mode of nodes: 1.1 One mode 1.2 Two nodes 2. By direction of edges: 2.1 Directed 2.2 Undirected 3. By weights of edges: 3.1 Weighted 3.2 Unweighted Any combination is possible!
L1: Introduction to Network Theory | 5. Network types Network types 24
1. By mode of nodes: 1.1 One mode 1.2 Two nodes 2. By direction of edges: 2.1 Directed 2.2 Undirected 3. By weights of edges: 3.1 Weighted 3.2 Unweighted Any combination is possible!
L1: Introduction to Network Theory | 5. Network types Network types 24
1. By mode of nodes: 1.1 One mode 1.2 Two nodes 2. By direction of edges: 2.1 Directed 2.2 Undirected 3. By weights of edges: 3.1 Weighted 3.2 Unweighted Any combination is possible!
L1: Introduction to Network Theory | 5. Network types Network types 24
1. By mode of nodes: 1.1 One mode 1.2 Two nodes 2. By direction of edges: 2.1 Directed 2.2 Undirected 3. By weights of edges: 3.1 Weighted 3.2 Unweighted Any combination is possible!
L1: Introduction to Network Theory | 5. Network types Unipartite networks 25
Unipartite networks (one mode)
■ All nodes are of the same nature;
■ E.g.: Social networks, Internet, WWW, Firms
Unipartite graph can also be:
■ Undirected unweighted: aij ∈ {0, 1}, A is symmetric - Simplification;
■ Directed unweighted: aij ∈ {0, 1}, A is asymmetric - Followers;
■ Undirected weighted: aij ∈ R, A is symmetric - Contact;
■ Directed weighted: aij ∈ R, A is asymmetric - Economic relations;
L1: Introduction to Network Theory | 5. Network types Unipartite networks 25
Unipartite networks (one mode)
■ All nodes are of the same nature;
■ E.g.: Social networks, Internet, WWW, Firms
Unipartite graph can also be:
■ Undirected unweighted: aij ∈ {0, 1}, A is symmetric - Simplification;
■ Directed unweighted: aij ∈ {0, 1}, A is asymmetric - Followers;
■ Undirected weighted: aij ∈ R, A is symmetric - Contact;
■ Directed weighted: aij ∈ R, A is asymmetric - Economic relations;
L1: Introduction to Network Theory | 5. Network types Unipartite networks 25
Unipartite networks (one mode)
■ All nodes are of the same nature;
■ E.g.: Social networks, Internet, WWW, Firms
Unipartite graph can also be:
■ Undirected unweighted: aij ∈ {0, 1}, A is symmetric - Simplification;
■ Directed unweighted: aij ∈ {0, 1}, A is asymmetric - Followers;
■ Undirected weighted: aij ∈ R, A is symmetric - Contact;
■ Directed weighted: aij ∈ R, A is asymmetric - Economic relations;
L1: Introduction to Network Theory | 5. Network types Unipartite networks 25
Unipartite networks (one mode)
■ All nodes are of the same nature;
■ E.g.: Social networks, Internet, WWW, Firms
Unipartite graph can also be:
■ Undirected unweighted: aij ∈ {0, 1}, A is symmetric - Simplification;
■ Directed unweighted: aij ∈ {0, 1}, A is asymmetric - Followers;
■ Undirected weighted: aij ∈ R, A is symmetric - Contact;
■ Directed weighted: aij ∈ R, A is asymmetric - Economic relations;
L1: Introduction to Network Theory | 5. Network types Unipartite networks 25
Unipartite networks (one mode)
■ All nodes are of the same nature;
■ E.g.: Social networks, Internet, WWW, Firms
Unipartite graph can also be:
■ Undirected unweighted: aij ∈ {0, 1}, A is symmetric - Simplification;
■ Directed unweighted: aij ∈ {0, 1}, A is asymmetric - Followers;
■ Undirected weighted: aij ∈ R, A is symmetric - Contact;
■ Directed weighted: aij ∈ R, A is asymmetric - Economic relations;
L1: Introduction to Network Theory | 5. Network types One-mode undirected unweighted 26
L1: Introduction to Network Theory | 5. Network types One-mode undirected unweighted 27
■ All connections are mutual and of the same strength
■ Adjacency matrix: symmetric, ∀i, j : aij ∈ {0, 1}
■ e.g.: Friendship network of Facebook users
L1: Introduction to Network Theory | 5. Network types One-mode directed unweighted 28
L1: Introduction to Network Theory | 5. Network types One-mode directed unweighted 29
■ Connections are not mutual, but of the same strength
■ Adjacency matrix: non-symmetric, ∀i, j : aij ∈ {0, 1}
■ e.g.: Follower network of Twi er users
h p://sites.davidson.edu L1: Introduction to Network Theory | 5. Network types One-mode undirected weighted 30
L1: Introduction to Network Theory | 5. Network types One-mode undirected weighted 31
■ All connections are mutual, but of different strength
■ Adjacency matrix: symmetric, ∀i, j : aij ∈ R
■ e.g.: Cooperation network between individuals in ICIC (1919-1927)
h p://www.martingrandjean.ch/intellectual-cooperation-multi-level-network-analysis/
L1: Introduction to Network Theory | 5. Network types One-mode directed weighted 32
L1: Introduction to Network Theory | 5. Network types One-mode directed weighted 33
■ Connections are not mutual and of different strength
■ Adjacency matrix: non-symmetric, ∀i, j : aij ∈ R
■ e.g.: Affinity network of EU countries at Eurovision 2009-2012
L1: Introduction to Network Theory | 5. Network types One-mode directed weighted 33
■ Connections are not mutual and of different strength
■ Adjacency matrix: non-symmetric, ∀i, j : aij ∈ R
■ e.g.: Affinity network of EU countries at Eurovision 2009-2012
L1: Introduction to Network Theory | 5. Network types One-mode directed weighted 33
■ Connections are not mutual and of different strength
■ Adjacency matrix: non-symmetric, ∀i, j : aij ∈ R
■ e.g.: Affinity network of EU countries at Eurovision 2009-2012
L1: Introduction to Network Theory | 5. Network types Bipartite networks 34
Bipartite networks (two modes)
■ Nodes are of two well-differentiated nature
■ Node of one type can only be connected to a node of another type;
■ e.g.:
■ Recommender systems (product/user) ■ Goods (buyer/product; buyer/seller; manufacturer/contractor)
Bipartite graph can also be:
■ Unweighted: aij ∈ {0, 1}, A is rectangular
■ Weighted: aij ∈ R, A is rectangular;
L1: Introduction to Network Theory | 5. Network types Bipartite networks 34
Bipartite networks (two modes)
■ Nodes are of two well-differentiated nature
■ Node of one type can only be connected to a node of another type;
■ e.g.:
■ Recommender systems (product/user) ■ Goods (buyer/product; buyer/seller; manufacturer/contractor)
Bipartite graph can also be:
■ Unweighted: aij ∈ {0, 1}, A is rectangular
■ Weighted: aij ∈ R, A is rectangular;
L1: Introduction to Network Theory | 5. Network types Bipartite networks 34
Bipartite networks (two modes)
■ Nodes are of two well-differentiated nature
■ Node of one type can only be connected to a node of another type;
■ e.g.:
■ Recommender systems (product/user) ■ Goods (buyer/product; buyer/seller; manufacturer/contractor)
Bipartite graph can also be:
■ Unweighted: aij ∈ {0, 1}, A is rectangular
■ Weighted: aij ∈ R, A is rectangular;
L1: Introduction to Network Theory | 5. Network types Bipartite networks 34
Bipartite networks (two modes)
■ Nodes are of two well-differentiated nature
■ Node of one type can only be connected to a node of another type;
■ e.g.:
■ Recommender systems (product/user) ■ Goods (buyer/product; buyer/seller; manufacturer/contractor)
Bipartite graph can also be:
■ Unweighted: aij ∈ {0, 1}, A is rectangular
■ Weighted: aij ∈ R, A is rectangular;
L1: Introduction to Network Theory | 5. Network types Bipartite networks 34
Bipartite networks (two modes)
■ Nodes are of two well-differentiated nature
■ Node of one type can only be connected to a node of another type;
■ e.g.:
■ Recommender systems (product/user) ■ Goods (buyer/product; buyer/seller; manufacturer/contractor)
Bipartite graph can also be:
■ Unweighted: aij ∈ {0, 1}, A is rectangular
■ Weighted: aij ∈ R, A is rectangular;
L1: Introduction to Network Theory | 5. Network types Bipartite networks: example 35
A supermarket chain wants to know which products are frequently bought together.
They have the following data:
L1: Introduction to Network Theory | 5. Network types Bipartite network: Nodes 36
L1: Introduction to Network Theory | 5. Network types Bipartite network: Edges 37
L1: Introduction to Network Theory | 5. Network types Bipartite networks: adjacency matrix 38
■ Blue nodes - reciepts; Green nodes - products
■ Edges exist only between nodes of different types.
■ Adjacency matrix for bipartite networks: block-matrix;
L1: Introduction to Network Theory | 5. Network types Bipartite networks: edge list 39
■ Blue nodes - receipts; Green nodes - products
■ Edges exist only between nodes of different types.
L1: Introduction to Network Theory | 5. Network types One mode projection 40
Link all products that were bought together on the same receipt
Consider receipt F first
L1: Introduction to Network Theory | 5. Network types One mode projection 41
Link all products that were bought together on the same receipt
Now consider receipt G
L1: Introduction to Network Theory | 5. Network types One mode projection 42
Link all products that were bought together on the same receipt
Finally, consider receipt I
L1: Introduction to Network Theory | 5. Network types One mode projection 43
Resulting graph is unipartite, undirected, unweighted
L1: Introduction to Network Theory | 5. Network types Network of ingredients 44
Network of ingredients that occur together more than by chance:
Teng, Lin, & Adamic (2011)
L1: Introduction to Network Theory | 5. Network types Simple network models
L1: Introduction to Network Theory | 6. Simple network models What are network models? 46
■ A model is an abstract, idealised description of reality that still captures a specific trait
■ Network models are constructed to represent complex systems: social, physical, information, etc.
■ In this course, we focus on network models of complex socio-economic systems
L1: Introduction to Network Theory | 6. Simple network models What are network models? 46
■ A model is an abstract, idealised description of reality that still captures a specific trait
■ Network models are constructed to represent complex systems: social, physical, information, etc.
■ In this course, we focus on network models of complex socio-economic systems
L1: Introduction to Network Theory | 6. Simple network models What are network models? 46
■ A model is an abstract, idealised description of reality that still captures a specific trait
■ Network models are constructed to represent complex systems: social, physical, information, etc.
■ In this course, we focus on network models of complex socio-economic systems
L1: Introduction to Network Theory | 6. Simple network models Simple network types 47
Fully connected network
■ All-to-all, well-mixed population;
■ Amenable for analytical calculations;
■ In most situations: artificial;
■ ki = N − 1
■ Diameter: 1
L1: Introduction to Network Theory | 6. Simple network models Simple network types 48
Star network
■ Extremely centralised;
■ Can represent topology of computer network (client-server)
■ k0 = N − 1, ki = 1∀i > 0
■ Diameter: 2
L1: Introduction to Network Theory | 6. Simple network models Regular networks 49
One dimensional la ice
■ Traffic lanes;
■ ki = 2κ
■ Diameter: ∝ N
L1: Introduction to Network Theory | 6. Simple network models Regular networks 50
Bi-dimensional la ice
■ Geographical data
■ ki = 4κ 1/2 ■ Diameter: ∝ N
L1: Introduction to Network Theory | 6. Simple network models Why these models are important? 51
■ These models represent some real-world structures (computer networks, geographical data, traffic lanes);
■ Can be used for analysis and modelling of the networks
■ Estimation of: connectivity, average (or maximum) load on lanes or server, etc.
■ Can be used for prediction of future behavior;
L1: Introduction to Network Theory | 6. Simple network models References I 52
▶ Chin-Yuen Teng, Yu-Ru Lin, Lada A. Adamic, Recipe recommendation using ingredient networks, arXiv preprint: arXiv:1111.3919, 2012.
L1: Introduction to Network Theory | 6. Simple network models Manuel Sebastian Mariani
URPP Social Networks
B [email protected] m h p://www.socialnetworks.uzh.ch
L1: Introduction to Network Theory | 6. Simple network models Exercise
L1: Introduction to Network Theory | 7. Exercise Degree distribution 55
■ Download one unipartite unweighted network from http://snap.stanford.edu/data/index.html, ideally composed of ∼ 1000 to 10, 000 nodes.
■ Describe the meaning of the nodes and the edges.
■ Analyze the network with a network-analysis package, using your favorite programming language.
■ Recommended: igraph, networkx.
L1: Introduction to Network Theory | 7. Exercise Degree distribution 56
■ Plot the selected network’s degree distribution P(k). Is it be er to plot it on a linear scale, or on a log-log scale? Discuss.
■ Compare with the expectation for a random graph:
PER (k) = N pk (1 − p)N−k−1.
(Find the normalization factor N .)
■ Are the observed and expected distribution similar? Discuss the meaning of the result.
L1: Introduction to Network Theory | 7. Exercise Manuel Sebastian Mariani
URPP Social Networks
B [email protected] m h p://www.socialnetworks.uzh.ch