421 Midterm 2 Revision and Practice Questions
421 Midterm 2 Revision and Practice Questions
Midterm 2 Revision
I respectfully acknowledge that UBC Okanagan is situated on the
traditional, unceded and ancestral territory of the Syilx Okanagan
Nation
Exam
• Will cover lectures 10 to 16
• Excluding lecture 14 – Writing an academic report
• 45 minutes
• 5 MCQ questions
• 5 short/long answer questions
• The topics in this revision class is not comprehensive
• You should study all that was covered in lectures 10 to 16
• Excluding lecture 14 – Writing an academic report
2
Lecture 10. Large Scale Structures
3
Objectives
• Describe components in real world networks
• Describe shortest path and small world effects
• Compute degree distribution for networks for both directed and undirected
graphs
4
Degree Distribution – Directed Graphs
1 5
4
6
Objectives
• Describe the power law and scale free networks with examples
• Identify hubs
• Identify some characteristics of scale-free networks
• Describe eigenvector centrality in real world networks
• Describe closeness and betweenness centrality in real world networks
• Explain what community detection is
• Identify modularity in terms of networks
• Compute modularity of networks and communities
• Apply community detection techniques that use maximization including:
• Simple modularity maximization
• The Louvain algorithm
7
Modularity
Community 1
m1 = 7
3
5 m = 13
7 k1 = 15
9 4 1 Q1 = 7/13 – (15/2*13)2
0.54 – 0.33 = 0.21
8 6 Community 2
2 m2 = 5
m = 13
mc = total number of edges in community cc k2 = 11
m = total number of edges in the network Q2 = 5/13 – (11/2*13)2
kc = total degree of the nodes in this community
0.38 – 0.18 = 0.20
Q = 0.21 + 0.20 = 0.41 8
Modularity
3
5
7
9 4
8 6
2
9
Lecture 12. Community Structure
10
Objectives
At the end of today’s class you should be able to:
• Explain community detection based on information theory
• Compute random walks
• Identify the edge betweenness community algorithm
• Compute edge betweenness
• Identify communities using hierarchical clustering
• Explain agglomerative algorithms and divisive algorithms
• Describe random networks
11
Random Walks
5 • The random walk starts from node 1
• What is the probability that the random walk
returns to 1 after exactly 3 steps
• Possible paths = (1,2,3,1), (1, 3,4,1), (1,3,2,1),(1,4,3,1,)
2 • P(1->2) = 1/3 P(1->3) = 1/3
3 4 = 1/36 P(3->2) = 1/4 = 1/36
• P(2->3) = 1/3
P(2->1) = 1/3
• P(3->1) = 1/4
P(1->4) = 1/3
• P(1->3) = 1/3 P(4->3) = 1/3 = 1/36
1 • P(3->4) = 1/4
= 1/36 P(3->1) = 1/4
• P(4->1) = 1/3
• 1/36 + 1/36 + 1/36 + 1/36 = 1/9
12
Random Walks
5 • The random walk starts from node 1
• What is the probability that the random walk
gets to node 5 after exactly 2 steps?
2 4
3
13
Edge Betweenness
• What edge has the highest edge betweenness?
• How many pairs of nodes go through an edge to get to each other?
A E
A B E
C D G
B F
D 14
Exercise
• Given the network below, what is the
probability that the random walk returns to 1
after exactly 3 steps? Note that the random
walk starts from node 1
• What is the probability that a random walker
will start from node 2 and walk to node 5 in the
next step?
• What is the probability that a random walker
will start from node 5 and walk to node 4 in the
next step?
15
Lecture 13. Network Models.
Random Networks
16
Objectives
• Describe random networks
• Computer the average degree of random networks
• Compute the degree distribution of random networks
• Describe the evolution of random networks
• Compute the clustering coefficient of random networks
• Describe some characteristics of random networks
17
Average Degree – Random Network
In the G(n, p) model, what is average degree of a random network with 5 nodes if
the probability of an edge existing between nodes is 0.3?
18
Lecture 15. Network Models.
Preferential Attachment
19
Objectives
At the end of today’s class, you should be able to:
• Describe the Barabási-Albert model of network formation
• Identify the factors needed for the Barabási-Albert model
• Describe what happens in the absence of these factors
20
Basic Barabási-Albert model
How many nodes and edges will be generated by the Barabási-Albert
model in the second timestep if the network starts with 2 nodes and 1
edge and grows by adding a node with 2 edges?
t=2
n0 = 2
m=2
Nodes = t + n0 = 2 + 2 = 4
Edges = m0 + mt = 1 + 2*2 = 5
21
Basic Barabási-Albert model
How many nodes and edges will be generated by the Barabási-Albert
model in the second timestep if the network starts with 3 nodes and 3
edges and grows by adding a node with 2 edges?
t=?
n0 = ?
m=?
Nodes = t + n0 =
Edges = m0 + mt =
22
Lecture 16. Network Models.
Preferential Attachment 2
23
Objectives
At the end of today’s class, you should be able to:
• Describe Price’s Model of preferential attachment
• Compute the probability of citing another node
• Compute the number of new citations to all nodes with a specific in-
degree
• Determine the in-degree distribution of Price’s model
24
Exercise
Given this directed network, according to
1 2 Price’s model, what is the probability that a
new paper(node) added to the network will
cite paper 5 given that the constant a is 1.
5 3
4
25