0% found this document useful (0 votes)
12 views424 pages

GTA Unit4

Uploaded by

shreyanav10
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
12 views424 pages

GTA Unit4

Uploaded by

shreyanav10
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 424

Graph Theory and its Applications

Community Detection

S Upadhyaya
Department of Computer Science and Engineering

These slides are the modified versions of the slides prepared by Dr. Bhaskarjyoti Das for the course “Network
mining and Analysis” with additional inputs from Dr. Arti Arya
Graph Theory and its Applications
What is community detection?

• The process of finding clusters of nodes


(‘‘communities’’)
• With Strong internal connections and
• Weak connections between different communities

• Ideal decomposition of a large graph


• Completely disjoint communities
• There are no interactions between different communities.

• In practice,
• find community partitions that are maximally decoupled.
Graph Theory and Its Applications
Types of Communities

Communities

Explicit/Emic/ Implicit/Etic/

1. Community members understand 1. Individuals interact with each other tacitly.


that they are its members.
Eg a person calling someone in Dubai from India
1. Non-members understand who on a daily basis need not be friends. But from
the community members are. phone operator point of view they form an
implicit community.
1. Community members often have
more interactions with each other 2. Consider people with same taste for movies
than with non-members on a movie rental site.
Graph Theory and Its Applications
Examples of Explicit Communities/ Implicit Communities

EXPLICIT
• Facebook

• Yahoo! Groups IMPLICIT


• Like people on movie rental site
• LinkedIn with similar taste for movies

• They will rarely be the members of


same Explicit community.

• But movie rental site is specifically


be interested
Graph Theory and Its Applications
Community detection vs. Clustering
Graph Theory and its Applications
Why community detection?
Network Summarization
• A community can be
considered as a summary of
the whole network
• Easier to visualize and
understand
Preserve Privacy
• [Sometimes] a community can
reveal some properties
without releasing the
individuals’ privacy
information.
Implicit communities are often
more useful. Community
detection is really around that.
Graph Theory and its Applications
Community detection vs. Clustering
Graph Theory and its Applications
Our plan for Community detection

Our plan
• We will learn three specific algorithms
• Clique Percolation Method
• Girvan Newman
• Louvain
• We will then look at the community detection
big picture and understand where everything
fits
• We finally look at how to evaluate
Graph Theory and its Applications

Clique Percolation Method (CPM)

S Upadhyaya
Department of Computer Science and Engineering
Graph Theory and Its Applications
Clique Percolation Method

• The clique percolation method builds


up the communities from cliques of
size k, which correspond to complete
(fully connected) sub-graphs
of k nodes. (E.g., a clique of size
k = 3 is equivalent to a triangle).

• Two cliques of size k are considered


adjacent if they share k − 1 nodes.
A simple graph with three communities,
• A community is defined as the enclosed by the dashed circles
maximal union of cliques of size k
that can be reached from each other
through a series of adjacent cliques
of size k.
Graph Theory and its Applications
Clique Percolation Method – use clique as seed

When using cliques as a seed or core of a community, we assume


communities are formed from a set of cliques (small or large) in addition
to edges that connect these cliques

• Input
• A parameter k (clique size) , and a network

• Algorithm ( require parameter k )


1) Cliquesk = all cliques of size k in the given network
2) Construct a clique graph G (V,E) such that |V| = |Cliquesk|
3) E = {eij | clique i and clique j share k-1 nodes
4) Return all connected components of G
Graph Theory and its Applications
Example using clique of size 3

Cliques of size 3:
{1, 2, 3}, {3, 4,5}, {4, 5,
7}, {4,5, 6}, {4,6,7}, {5,6,
7}, {6, 7, 8}, {8,9,10}

Communities:
{1, 2, 3}
{8,9,10}
{3,4, 5, 6, 7, 8}
Graph Theory and its Applications
CPM – points to note

• The algorithm searches for all cliques of size k and is


therefore computationally intensive. In practice, when
using the CPM algorithm, we often solve for a small k to
perform faster.
• CPM can return overlapping communities.
Graph Theory and Its Applications
Clique Percolation Method – use clique as seed

Taking k=-3

Step 1:
Find Cliques of size 3.

{1,2,3}, {1, 3, 4}, {4, 5, 6},


{5, 6. 8}, {5, 6, 7}, {7,8,6},
{5, 7, 8}

Step 2: Form edges


between cliques where 2
cliques share k-1 nodes(
ie 3-1=2 nodes)
Overlapping Community Detection using CPM
Graph Theory and its Applications
Finding overlapping Communities by CPM

⮚ Clique of size 3 : Complete graph with 3 vertices

clique of size 3
Graph Theory and its Applications
Finding overlapping Communities by CPM

⮚ Clique of size 4 : Complete graph with 4 vertices

Clique of size 4
Graph Theory and its Applications
Finding overlapping Communities by CPM

⮚ Clique of size 5 : Complete graph with 5 vertices

Clique of size 5
Graph Theory and its Applications
Finding overlapping Communities by CPM

⮚ Adjacent cliques of size K


• are adjacent when they share k-1 nodes
Graph Theory and its Applications
Finding overlapping Communities by CPM

⮚ Adjacent cliques of size K


Two cliques of size K are adjacent when they share k-1 nodes

k=3
Graph Theory and its Applications
Finding overlapping Communities by CPM

⮚Adjacent cliques of size K


Two cliques of size K are adjacent when they share k-1
nodes

k=3

Clique 1:
Graph Theory and its Applications
Finding overlapping Communities by CPM

⮚ Adjacent cliques of size K


Two cliques of size K are adjacent when they share k-1 nodes

Clique 2
k=3
Graph Theory and its Applications
Finding overlapping Communities by CPM

⮚ Adjacent cliques of size K


Two cliques of size K are adjacent when they share k-1 nodes

Clique 3
k=3
Graph Theory and its Applications
Finding overlapping Communities by CPM

⮚ Adjacent cliques of size K


Two cliques of size K are adjacent when they share k-1 nodes

Clique 2
k=3

Clique 1

Clique-1 and Clique-2 are adjacent because they share k-1


Graph Theory and its Applications
Finding overlapping Communities by CPM

⮚ Adjacent cliques of size K


Two cliques of size K are adjacent when they share k-1 nodes

Clique 2 Clique 3
k=3

Clique-2 and Clique-3 are not adjacent because they are


not sharing k-1 nodes
Graph Theory and its Applications
Finding overlapping Communities by CPM

Clique Community by CPM


Union of all cliques of size k that can be reached from
each other.
Graph Theory and its Applications
Finding overlapping Communities by CPM

Clique Community by CPM


Union of all cliques of size k that can be reached from
each other.

Clique 2
k=3

Clique 1
Graph Theory and its Applications
Finding overlapping Communities by CPM

Clique Community by CPM


Union of all cliques of size k that can be reached from
each other.
Clique
Community

Community 1

k=3
Graph Theory and its Applications
Finding overlapping Communities by CPM

Clique Community by CPM


Union of all cliques of size k that can be reached from
each other.

Community 1 Clique 3
k=3
Graph Theory and its Applications
Finding overlapping Communities by CPM

Clique Community by CPM


Union of all cliques of size k that can be reached from
each other.
Clique Communities

Community 1
Community 2
k=3

Community-1 and Community-2 are overlapping


Graph Theory and its Applications
Finding overlapping Communities by CPM

⮚ Problem: Given G and k=4. Find


communities and overlapping
communities using CPM.

Note: k indicates finding communities of size k or more.


Graph Theory and its Applications
Finding Overlapping Communities by CPM :
Algorithm
Algorithm:
Input: Given graph G, and k (k: find communities of size k or more)

1. Locate maximal cliques

2. Convert from cliques to communities


Graph Theory and its Applications
Finding Overlapping Communities by CPM

1. Locate Maximal Cliques

a) Largest possible clique size can be determined from degrees of vertices

b) Starting from this size, find all cliques, then reduce size by 1 and repeat
Graph Theory and its Applications
Finding Overlapping Communities by CPM

Locate maximal cliques 10

1 4

5 9

2 3

6 7
Graph Theory and its Applications
Finding overlapping Communities by CPM

Locate maximal cliques - size 5

Clique 1: 5-clique
A 5-clique contains five 4-
cliques
Graph Theory and its Applications
Finding overlapping Communities by CPM

Locate maximal cliques


Graph Theory and its Applications
Finding overlapping Communities by CPM

Locate cliques of size 4

Clique 2: 4-clique
Graph Theory and its Applications
Finding overlapping Communities by CPM

Locate maximal cliques


Graph Theory and its Applications
Finding overlapping Communities by CPM

Locate maximal cliques


Graph Theory and its Applications
Finding overlapping Communities by CPM

Locate maximal cliques

Clique 5: 3-clique
Graph Theory and its Applications
Finding overlapping Communities by CPM

Algorithm

1. Locate maximal cliques

2. Convert from cliques to communities


Graph Theory and its Applications
Finding overlapping Communities by CPM

2. Convert from cliques to k-clique communities


a) Create a square matrix CCn×n, where n is the number of cliques found.
Each cell CC[i, j] contains number of nodes shared by cliques Ci and Cj.

b) If CC[i,i] (diagonal elements )is less than k, then delete.

c) If CC[i,j] (non-diagonal elements) is less than k-1, then delete.

d) Change all non-zeros to 1.

e) Combine adjacent cliques to form a community.


Graph Theory and its Applications
Finding overlapping Communities by CPM

Cliques to k-Clique
Communities
Clique-5

Clique-6
Clique-
3 Clique-
2
Clique-
1
Clique-
4
Graph Theory and its Applications
Finding overlapping Communities by CPM

Cliques to k-Clique Communities


C1 C2 C3 C4 C5 C6
C1 5
C2 4
C3 4
C4 4
C5 3
C6 3

Step-a: Construct a matrix CCn×n ,where n represents the total number of cliques. Each cell CC[i, j]
contains number of nodes shared by cliques Ci and Cj.
Graph Theory and its Applications
Finding overlapping Communities by CPM

Cliques to k-Clique Communities


C1 C2 C3 C4 C5 C6
C1 5 3 1 3 1 2
C2 3 4 1 1 1 2
C3 1 1 4 2 1 2
C4 3 1 2 4 0 1
C5 1 1 1 0 3 2
C6 2 2 2 1 2 3

Step-a: Construct a matrix CCn×n ,where n represents the total number of cliques. Each
cell CC[i, j] contains number of nodes shared by cliques Ci and Cj.
Graph Theory and its Applications
Finding overlapping Communities by CPM

Cliques to k-Clique Communities


C1 C2 C3 C4 C5 C6
C1 5 3 1 3 1 2
C2 3 4 1 1 1 2
C3 1 1 4 2 1 2
C4 3 1 2 4 0 1
C5 1 1 1 0 3 2
C6 2 2 2 1 2 3

Notice that this is a Symmetric Matrix


Graph Theory and its Applications
Finding overlapping Communities by CPM

Cliques to k-Clique Communities


C1 C2 C3 C4 C5 C6
Given k=4
C1 5 3 1 3 1 2
C2 3 4 1 1 1 2
C3 1 1 4 2 1 2
C4 3 1 2 4 0 1
C5 1 1 1 0 3 2
C6 2 2 2 1 2 3

Note: Given k in problem statement represents Community size


(i.e., find communities of size k or more)
Graph Theory and its Applications
Finding overlapping Communities by CPM

Cliques to k-Clique Communities


C1 C2 C3 C4 C5 C6
Given k=4
C1 5 3 1 3 1 2
C2 3 4 1 1 1 2
C3 1 1 4 2 1 2
C4 3 1 2 4 0 1
C5 1 1 1 0 0 2
C6 2 2 2 1 2 0

Step-b: If CC[i,i] is less than k, then delete or set to 0


Graph Theory and its Applications
Finding overlapping Communities by CPM

Cliques to k-Clique Communities


C1 C2 C3 C4 C5 C6
Given k=4
C1 5 3 0 3 0 0
C2 3 4 0 0 0 0
C3 0 0 4 0 0 0
C4 3 0 0 4 0 0
C5 0 0 0 0 0 0
C6 0 0 0 0 0 0

Step-c: If CC[i,j] (i≠j), is less than k-1, then delete


Graph Theory and its Applications
Finding overlapping Communities by CPM

Cliques to k-Clique Communities


C1 C2 C3 C4 C5 C6
Given k=4
C1 5 3 0 3 0 0
C2 3 4 0 0 0 0
C3 0 0 4 0 0 0
C4 3 0 0 4 0 0
C5 0 0 0 0 0 0
C6 0 0 0 0 0 0

Step-d: Change all non-zeros to 1 →Result in next slide


Graph Theory and its Applications
Finding overlapping Communities by CPM

Cliques to k-Clique Communities


C1 C2 C3 C4 C5 C6
k=4
C1 1 1 0 1 0 0
C2 1 1 0 0 0 0
C3 0 0 1 0 0 0
C4 1 0 0 1 0 0
C5 0 0 0 0 0 0
C6 0 0 0 0 0 0

Step-e: Combine adjacent cliques to form a community.


Graph Theory and its Applications
Finding overlapping Communities by CPM

Cliques to k-Clique Communities


C1 C2 C3 C4 C5 C6
C1 1 1 0 1 0 0

Clique-clique C2 1 1 0 0 0 0
overlap matrix C3 0 0 1 0 0 0
C4 1 0 0 1 0 0
C5 0 0 0 0 0 0
C6 0 0 0 0 0 0
Row 1 indicates clique-1 is adjacent to itself, clique-2 and clique-4.
Row 2 indicates clique-2 is adjacent to clique-1 and itself. (already seen in row 1)
Row 3 indicates clique-3 is adjacent to itself only.
Row 4 indicates clique-4 is adjacent to clique-1 and itself. (already seen in row 1)
Graph Theory and its Applications
Finding overlapping Communities by CPM

Cliques to k-Clique
Communities

Clique 2

Clique 1

Clique 4

Community 1
Graph Theory and its Applications
Finding overlapping Communities by CPM

Cliques to k-Clique
Communities

Clique 3

Community 2
Graph Theory and its Applications
Finding overlapping Communities by CPM

Cliques to k-Clique Communities


Identified communities Community-1 and Community-2 are
overlapping.

Community-2

Community-1
Graph Theory and its Applications
Finding overlapping Communities by CPM

⮚ Exercise 1: Find communities and overlapping communities of size


greater than or equal to 3 using Clique Percolation Method (CPM).
Show matrix computation.
Graph Theory and Its Applications
Finding overlapping Communities by CPM
• Clique 1:
4-clique:
{2,4,6,5}
• Clique 2:
3-clique:
{1,3,2}
• Clique 3:
3-clique:
{1,8,2}

Check if diagonal elements are <k(i.e., 3):


They are not less than 3.
Hence , diagonal elements will remain as they are.
Graph Theory and Its Applications
Finding overlapping Communities by CPM
Check if non-diagonal elements are < k−1 (i.e, 2)
Then make them zero

Check if non-diagonal elements are <k-1(ie 2), then


make them 0.

Replace all non-zero elements by 1.

C1​ is adjacent to itself.


C2​ is adjacent to itself and C3
C3​ is adjacent to itself and C2
Therefore, C1​ forms one community, and C2∪C3
forms another community.
Graph Theory and its Applications
Finding overlapping Communities by CPM

⮚ Exercise 2: Given G and k=3, find communities and overlapping


communities using CPM. Show matrix computation.
Graph Theory and Its Applications

C1 C2 C3 C4 C5

C1 4 2 3 0 0

C2 2 4 3 1 1

C3 3 3 4 1 1

C4 0 1 1 4 3

C5 0 1 1 3 4

In the above table if diagonal element ≤3, then make it = 0


In the above table ,if the non-diagonal element <k−1 (i.e., 2), then make
it = 0.
Graph Theory and Its Applications

C1 C2 C3 C4 C5

C1 4 2 3 0 0

C2 2 4 3 0 0

C3 3 3 4 0 0

C4 0 0 0 4 3

C5 0 0 0 3 4

In the above table, replace all non-zero elements by 1.


Graph Theory and Its Applications

C1 C2 C3 C4 C5
C1 1 1 1 0 0
C2 1 1 1 0 0
C3 1 1 1 0 0
C4 0 0 0 1 1
C5 0 0 0 1 1
Graph Theory and Its Applications

• From the previous matrix, clearly:


• C1​ is adjacent to itself, C2 & C3​.
• C2is adjacent to itself, C1& C3​.
• C3​ is adjacent to itself, C1​ & C2.
• C4​ is adjacent to itself & C5​.
• C5​ is adjacent to itself & C4.
Therefore,
• {A,B,C,D,E,F}is Community 1.
• {F,G,H,I,J}is Community 2.
Graph Theory and its Applications
Finding overlapping Communities by CPM

⮚ Exercise 3: Given G and k=3, find communities and overlapping


communities using CPM. Show matrix computation.
Graph Theory and Its Applications
Finding overlapping Communities by CPM

C1 C2 C3 C4 C5
C1 3 2 0 0 0

C2 2 3 1 0 0

C3 0 1 3 2 1

C4 0 0 2 3 2

C5 0 0 1 2 3

• In the above table if diagonal element ≤3, then make it = 0


• In the above table ,if the non-diagonal element <k−1 (i.e., 2), then make
it = 0.
Graph Theory and Its Applications

Finding overlapping Communities by CPM

C1 C2 C3 C4 C5
C1 3 2 0 0 0

C2 2 3 0 0 0

C3 0 0 3 2 0

C4 0 0 2 3 2

C5 0 0 0 2 3

• In the above table, replace all non-zero elements


by 1.
Graph Theory and Its Applications
Finding overlapping Communities by CPM

C1 C2 C3 C4 C5
C1 1 1 0 0 0

C2 1 1 0 0 0

C3 0 0 1 1 0

C4 0 0 1 1 1

C5 0 0 0 1 1
Graph Theory and Its Applications
Finding overlapping Communities by CPM

• From the previous matrix, clearly:


• C1​ is adjacent to itself & C2​.
• C2is adjacent to itself &C1.
• C3​ is adjacent to itself &C4.
• C4​ is adjacent to itself ,C3 & C5​.
• C5​ is adjacent to itself & C4.
• Therefore:
• {1,2,3,4}is Community 1.
• {4,5,6,7,8}is Community 2.
Graph Theory and its Applications
Finding overlapping Communities by CPM

⮚ Exercise 4: Given G and k=3, find communities and overlapping


communities using CPM. Show matrix computation.
Graph Theory and Its Applications
Finding overlapping Communities by CPM

C1 C2 C3 C4 C5
C1 4 0 2 2 0

C2 0 3 1 0 0

C3 2 0 3 0 0

C4 2 0 0 3 1

C5 0 0 0 1 3

• In the above table if diagonal element ≤3, then make it = 0


• In the above table ,if the non-diagonal element <k−1 (i.e., 2), then make
it = 0.
Graph Theory and Its Applications
Finding overlapping Communities by CPM

C1 C2 C3 C4 C5
C1 4 0 2 2 0

C2 0 3 0 0 0

C3 2 0 3 0 0

C4 2 0 0 3 0

C5 0 0 0 0 3

• In the above table, replace all non-zero


elements by 1.
Graph Theory and Its Applications
Finding overlapping Communities by CPM

C1 C2 C3 C4 C5
C1 1 0 1 1 0

C2 0 1 0 0 0

C3 1 0 1 0 0

C4 1 0 0 1 0

C5 0 0 0 0 1
Graph Theory and Its Applications
Finding overlapping Communities by CPM

• From the previous matrix, clearly:


• C1​ is adjacent to itself,C3 & C4​.
• C2is adjacent to itself .
• C3​ is adjacent to itself &C1.
• C4​ is adjacent to itself ,C1​.
• C5​ is adjacent to itself .
• Therefore:
{V3,V4,V5,V6,V7,V8} is Community 1.
• {V1,V2,V3}is Community 2
• {V8,V9,V10}is Community 3
Graph Theory and its Applications
Finding overlapping Communities by CPM

⮚ Exercise 5: Given G and k=3, find communities and overlapping


communities using CPM. Show matrix computation.
V15

V2V2 Clique of size 4:{V1,V2,V3,V4}


V14 (C1)
V1 V13 {V1,V3,V4,V5}
V3 (C2)
V16
{V9,V10,V11,V12}
(C3)
V10 {V10,V11,V12,V13}
V6
(C4)
V5
V4 V12 Clique of size 3:{V3,V4,V5}
V8 V9 (C5)
{V5,V7,V8}
(C6)
V7 V11
{V5,V6,V8}
(C7)
{V6,V8,V9}
(C8)
Graph Theory and Its Applications

Finding overlapping Communities by CPM

C1 C2 C3 C4 C5 C6 C7 C8 C9 C1 • In this table if diagonal


C1 4 3 0 0 2 0 0 0 0
0
0
element ≤3, then make it = 0
C2 3 4 0 0 3 1 1 0 0 0 • In this table ,if the non-
C3
C4
0
0
0
0
4
0
0
4
0
0
0
0
0
0
1
0
0
0
0
0
diagonal element <k−1 (i.e., 2),
C5 2 3 0 0 3 1 1 0 0 0 then make it = 0.
C6 0 1 0 0 1 3 2 1 0 0
C7 0 1 0 0 1 2 3 2 1 0
C8 0 0 1 0 0 1 2 3 1 0
C9 0 0 0 0 0 0 1 1 3 2
C10 0 0 0 0 0 0 0 0 2 3
Graph Theory and Its Applications
Finding overlapping Communities by CPM

• In this table, replace all non-


C1 C2 C3 C4 C5 C6 C7 C8 C9 C1
0 zero elements by 1.
C1 4 3 0 0 2 0 0 0 0 0
C2 3 4 0 0 3 0 0 0 0 0
C3 0 0 4 0 0 0 0 0 0 0
C4 0 0 0 4 0 0 0 0 0 0
C5 2 3 0 0 3 0 0 0 0 0
C6 0 0 0 0 0 3 2 0 0 0
C7 0 0 0 0 0 2 3 2 0 0
C8 0 0 0 0 0 0 2 3 0 0
C9 0 0 0 0 0 0 0 0 3 2
C10 0 0 0 0 0 0 0 0 2 3
Graph Theory and Its Applications
Finding overlapping Communities by CPM
C1 C2 C3 C4 C5 C6 C7 C8 C9 C1
0
• From the previous matrix, clearly:
C1 1 1 0 0 1 0 0 0 0 0
• C1​ is adjacent to itself ,C2& C5​.
C2 1 1 0 0 1 0 0 0 0 0
• C2is adjacent to itself ,C1&C5.
C3 0 0 1 0 0 0 0 0 0 0
• C3​ is adjacent to itself.
C4 0 0 0 1 0 0 0 0 0 0
• C4​ is adjacent to itself .
C5 1 1 0 0 1 0 0 0 0 0
• C5​ is adjacent to itself ,C1& C2.
C6 0 0 0 0 0 1 1 0 0 0
• C6 is adjacent to itself & C7.
C7 0 0 0 0 0 1 1 1 0 0
• C7​ is adjacent to itself ,C6& C8..
C8 0 0 0 0 0 0 1 1 0 0
• C8 is adjacent to itself & C7.
C9 0 0 0 0 0 0 0 0 1 1
• C9​ is adjacent to itself & C10.
C10 0 0 0 0 0 0 0 0 1 1 Therefore:
• C10​ is adjacent to itself &C9.
• {V1,V2,V3,V4,V5} is Community 1.
• {V5,V6,V7,V8,V9} is Community 2.
• {V6,V14,V15,V16} is Community 3.
• {V9,V10,V11,V12} is Community 4.
• {V10,V11,V12,V13} is Community 5.
Graph Theory and its Applications
CPM Algorithm
THANK YOU

S Upadhyaya
Department of Computer Science and Engineering
[email protected]
Graph Theory and Its Applications

Girvan Newman Algorithm for


Community Detection
Sujatha R Upadhyaya
Department of Computer Science
and Engineering

These slides are the modified versions of the slides prepared by Dr. Bhaskarjyoti Das for the course “Network
mining and Analysis” with additional inputs from Dr. Arti Arya
Graph Theory and its Applications

Girvan Newman Algorithm – Group


based community detection

Sujatha R Upadhyaya
Department of Computer Science and Engineering
Graph Theory And its Applications
Newman Girvan Algorithm
• The idea behind Newman Girvan
Algo is:
• If a n/w has a set of communities
and these communities are
connected to each other with few
edges, then all shortest paths
between members of different
communities should pass thru
these edges.

• By removing these edges we can


obtain communities in the n/w
Graph Theory And its Applications
Edge betweenness

Edge betweenness is the number of shortest paths that pass


along with the edge
• Edge betweenness measures the “bridgeness” of an edge
between two communities
• The edge with high betweenness tends to be the bridge
between two communities.
Graph Theory And its Applications
The Girvan Newman Algorithm

1. Calculate edge betweenness for all edges in the graph.

1. Remove the edge with the highest edge betweenness.

1. Recalculate betweenness for all edges affected by the edge removal


(unaffected edges need not be recalculated)

1. Repeat step 2 until no edges remain.


• Divisive hierarchical clustering.
• To determine weakest links, the algorithm uses edge
betweenness.
.
Graph Theory And its Applications
Community Detection: Girvan–Newman(the simplest case)

Breadth-first search find shortest paths from a vertex s to all others in time O(m).
In the simplest case, when there is only a single shortest path from the source vertex
to any other the resulting set of paths forms a shortest path tree—see Fig. a.
Graph Theory And its Applications
Community Detection: Girvan–Newman (the simplest case)

Use this tree to calculate the contribution to betweenness for each edge from
this set of paths as follows.
• Find first the “leaves” of the tree, i.e., those nodes such that no shortest
paths to other nodes pass through them, and assign a score of 1 to the
single edge that connects each to the rest of the tree, as shown in the
figure.
• Then, starting with those edges that are farthest from the source vertex
on the tree, i.e., lowest in Fig. a, we work upwards, assigning a score to
each edge i.e. 1 plus the sum of the scores on the neighboring edges
immediately below it.
• When we have gone though all edges in the tree, the resulting scores are
the betweenness counts for the paths from vertex s.
• Repeating the process for all possible vertices s and summing the scores,
we arrive at the full betweenness scores for shortest paths between all
pairs.
Graph Theory And its Applications
Community Detection: Girvan–Newman (more than one shortest path)

⮚ For cases in which there is more than one shortest path to


some vertices, the calculation is more complex.

First we must calculate the number of paths from the source


to each other vertex (numbers on vertices), and then these
are used to weight the path counts appropriately.
Graph Theory And its Applications
Community Detection: Girvan–Newman

Calculation of shortest-path betweenness for each edge


(for a given root node to all other nodes in the graph) :
⮚ step 1 – assign levels using BFS
⮚ step 2 – calculate # of shortest paths for node considering its
predecessors in the previous level
⮚ step 3 – calculate betweenness of each edge starting from
leaf level to the root node
Graph Theory And its Applications
Girvan–Newman example : step 1 – assign levels using BFS

0
A B C Source node

1
1
E F
D

2
2

3
Graph Theory And its Applications
Girvan–Newman example : step 1 – assign levels using BFS

⮚ Start with source node A and use BFS


⮚ A is at level 0
⮚ B and D are directly connected with A in a single
hop: level 1
⮚ From B, we go to C & E ( 1 more hop) : level 2
⮚ From B and E , we can go to F is connected (1 more
hop): level 3
Graph Theory And its Applications
Girvan–Newman example : step 2 – calculate # of shortest paths

• By convention, #shortest paths from source node A to itself : 1


• We go to next level node iteratively where no of shortest paths =
sum of # shortest paths of the predecessors at the previous
levels 1
• For B , predecessor is A . So, #SP for B = 1 , similarly for D Source node
• For E, predecessors at previous level are B and D. So, #SP for E = 2
• For C, predecessors at previous levels is B. So, #SP for C = 1
• For F, predecessors at previous levels are C and E. So, #SP for F = 3
1
1

2
1

3
Graph Theory And its Applications
Girvan–Newman example : step 3 – calculate betweenness of edge

1
Source node
1+1.33+0.835 1.835
1 =3.165
1 1
1
1
1.33 1.667/2 = 0.835

2 1+ 0.667 = 1.667
2
1

1/3 = 0.33 2/3 = 0.667

3 • We start from leaf level and go upwards to


3 the source node
• Every node contributes 1 unit of flow which
is divided as per the number of shortest
paths
SOCIAL NETWORK ANALYTICS
Girvan–Newman example : step 3 – calculate betweenness of edge

1
Source node
1
Source node

1
1
1
1

2
1 2
1

3
3
SOCIAL NETWORK ANALYTICS
Girvan–Newman example : step 3 – calculate betweenness of edge

1
Source node
1
Source node

1
1
1
1

2
1 2
1

3
3
SOCIAL NETWORK ANALYTICS
Girvan–Newman example : step 3 – calculate betweenness of edge

1
Source node
1
Source node

1 1
1 1
1
1

2 2
2 2
Graph Theory And its Applications
Girvan–Newman example : Step 4 - estimate starting from each node
Estimate betweenness of each edge starting from each node
Sum up betweenness for each edge
Divide by 2 if undirected
Edge Total Edge Betwenness Final
AB 3.165+1.5 +1.33 + 0.835 + 0.5 + 0.667 = 8 4
AD 1.835+0.5 + 0.33 + 1.835+0.5 + 0.33 = 5.33 2.67
BC 3.165+1.5+ 1.33 +0.835+0.5+0.667 = 8 4
BE 0.835+2+0.835+0.835+2+0.835 = 7.34 3.67
CF 1.835+0.5+0.33+1.835+0.5+0.33 =5.33 2.67
DE 3.165+1.5+1.33+0.835+0.5+0.667= 8 4
EF 3.165+1.5 + 1.33+ 0.835+0.5 + 0.667 = 8 4

Note : If the graph is directed, you just need to process the directed version of the
edge betweenness, i.e. count the directed shortest paths going through an edge.
Graph Theory and Its Applications
After removing the edges with max betweenness

A B C C
A B

E F F
D D E
Graph Theory, Applications and Combinatorics
Social Network Analysis

The Girvan-Newman Algorithm


Example 2
Graph Theory, Applications and Combinatorics
Social Network Analysis

The Girvan-Newman Algorithm


Graph Theory, Applications and Combinatorics
Social Network Analysis

The Girvan-Newman Algorithm


Graph Theory, Applications and Combinatorics
Social Network Analysis

The Girvan-Newman Algorithm


Graph Theory, Applications and Combinatorics
Social Network Analysis

The Girvan-Newman Algorithm


Graph Theory, Applications and Combinatorics
Social Network Analysis

The Girvan-Newman Algorithm

2
Graph Theory, Applications and Combinatorics
Social Network Analysis

The Girvan-Newman Algorithm

2
Graph Theory, Applications and Combinatorics
Social Network Analysis

The Girvan-Newman Algorithm

2
Graph Theory, Applications and Combinatorics
Social Network Analysis

The Girvan-Newman Algorithm

2
Graph Theory, Applications and Combinatorics
Social Network Analysis

The Girvan-Newman Algorithm

2
Graph Theory, Applications and Combinatorics
Social Network Analysis

The Girvan-Newman Algorithm

2
Graph Theory, Applications and Combinatorics
Social Network Analysis

The Girvan-Newman Algorithm


Graph Theory, Applications and Combinatorics
Social Network Analysis

The Girvan-Newman Algorithm


Graph Theory, Applications and Combinatorics
Social Network Analysis

The Girvan-Newman Algorithm


Graph Theory, Applications and Combinatorics
Social Network Analysis

The Girvan-Newman Algorithm


Graph Theory, Applications and Combinatorics
Social Network Analysis

The Girvan-Newman Algorithm


Graph Theory, Applications and Combinatorics
Social Network Analysis

The Girvan-Newman Algorithm

2
Graph Theory, Applications and Combinatorics
Social Network Analysis

The Girvan-Newman Algorithm

we divide by 2 to get the true betweenness, as every shortest path is discovered twice once for each of its endpoints.
Graph Theory, Applications and Combinatorics
Social Network Analysis

The Girvan-Newman Algorithm


Graph Theory, Applications and Combinatorics
Social Network Analysis

The Girvan-Newman Algorithm


As the last step we start with removing the edge with largest betweenness
centrality to form clusters. We can stop when we find the right number of
clusters or when it is not possible to remove any edge

First edge to leave the graph is BD (12)


Graph Theory, Applications and Combinatorics
Social Network Analysis

The Girvan-Newman Algorithm


After removing BD, the two clusters formed by ABC and DEFG look good,
However we can continue to remove (A,B) (B,C) with a score of 5, followed by
(D,E) and (D,G) with a score of 4.5.Lastly, (D, F) and the graph looks as below

More interpretations?
Graph Theory, Applications and Combinatorics
Social Network Analysis

Step 1:
Build a breadth-first search (BFS) of the graph, starting at the node X.
Mark the levels in the BFS graph.
The level of each node indicates the length of the shortest path from X to that
node.
Thus, the edges that go between nodes at the same level can never be part of a
shortest path from X.

Step 2:
Label each node by the number of shortest paths that reach it from the root.

Start by labeling the root 1. Then, from the top down, label each node Y by the
sum of the labels of its parents.
Graph Theory, Applications and Combinatorics
Social Network Analysis

Step 3:
Calculate betweenness score for each edge e
This calculation involves computing this sum for both nodes and edges, from
the bottom.
Each node other than the root is given a credit of 1, representing the
shortest path to that node.
This credit may be divided among nodes and edges above, since there
could be several different shortest paths to the node.
The rules for the calculation are as follows:
1. Each leaf in the DAG (a leaf is a node with no DAG edges to nodes at levels
below) gets a credit of 1.
2. Each node that is not a leaf gets a credit equal to 1 plus the sum of the
credits of the DAG edges from that node to the level below.
Graph Theory and Its Applications
Community Detection: Girvan–Newman

Time complexity:
⮚ Now repeating this process for all n source vertices for m edges
gives us the total betweenness for all edges in time O(mn)
⮚ Repeat this calculation for each of m edges removed from the
network and hence the complete community structure
algorithm based on shortest-path betweenness operates in
worst-case time O(m2n)
⮚ This can be considered as O(n3) on a sparse graph where m
scales with n in the limit of large n.
Graph Theory and Its Applications

Modularity based Community Detection


Graph Theory And its Applications
Community detection, modularity and density

• Communities are somewhat like clusters with dense population of edges


that are not seen in other parts of the graph. It is a soft structure in the graph.
• Community detection algorithms try to add a node to a community (based on
existing edges) if it improves the community density else not. Addition here
means redefine the boundary of the community
• Now how to define the quality of the improvement in density ( that can
happen by adding a node to an existing community or by combining existing
communities) ?
• So comes Modularity
• Modularity is a measure that defines how likely the community structure
found is created at random. Clearly, community structures should be far
from random
Graph Theory And its Applications
A close parallel

• Recall Pearson Correlation coefficient formula


• We try to capture the difference between the actual value and the
expected (random) one.
• The numerator is the real information and the denominator is just
the normalization mechanism
Graph Theory And its Applications
Modularity intuition

• Hypothesis : Random network does not have community structure.

• Real-world communities are far from random; therefore, the more distant they
are from randomly generated communities, the more structure they exhibit.

• Modularity defines this distance. Modularity and modularity maximization tries to


maximize this distance by optimally defining the communities.

• Modularity is the fraction of edges that falls within the given groups minus the
expected fraction if edges were distributed at random

• Quality function is defined with the above optimization in mind


Graph Theory And its Applications
Modularity intuition

• Modularity is a goodness factor of partition calculated by a certain


algorithm: the greater the value of modularity, better is the
structure of the communities found.

• Value of modularity lies in (-1,1)


• -1 : non modular structure
• 1 : fully modular
• 0 : fraction of edges inside the community is like random case

• Modularity is positive if the # of edges within groups exceeds the #


expected on the basis of chance.
Graph Theory And its Applications
Hypothesis In Modularity based Community Detection

H1: A network’s community structure is H4: Random Hypothesis


uniquely encoded in its wiring diagram
Randomly wired networks are not
H2: Connectedness Hypothesis expected to have a community
structure.
A community corresponds to a connected
subgraph. H5: Maximal Modularity Hypothesis

H3: Density Hypothesis The partition with the maximum


modularity M for a given network offers
Communities correspond to locally dense the optimal community structure
neighborhoods of a network.
Graph Theory And its Applications
Local Modularity vs. Modularity

• Local modularity: is a measure of how well a node and its neighbors


form a community in a n/w.
• Local modularity compares the number of links between the real
network wiring of a subgraph and the randomly rewired subgraph.
• Summing up the local modularity across all subgraphs in the
graph computes the modularity of the entire network.
Graph Theory And its Applications
Modularity formula

• Modularity formula:
Graph Theory And its Applications
Example - Modularity Calculation with 2 possible partitions
Graph Theory And its Applications
Example - Modularity Calculation with 2 possible partitions
Consider a possible
partitions.

Solution:
m=24
In the part 1

lc=14 (14 links/edges in partition 1)


kc=30

In the part 2
lc=8
kc​=18
Graph Theory And its Applications
Example - Modularity Calculation with 2 possible partitions
Modularity calculation with 2 possible parts shown on previous slide.
Graph Theory And its Applications
Example - Modularity Calculation with 2 possible partitions
Consider another possible partition .
NETWORK ANALYSIS AND MINING
Example - Modularity Calculation with 2 possible partitions

Consider another possible partition .

Conclusion:
•Q is larger for the 1st partition than the 2nd one.
•1st set of communities is better.
Graph Theory And its Applications
Network Modularity Varies Across Partitions

• Optimal partition, that maximizes the


modularity.
• Sub-optimal but positive modularity.
• Negative Modularity: If we assign each node
to a different community.
• Zero modularity: Assigning all nodes to the
same community, independent of the
network structure.
• Modularity is size dependent

• Modularity value varies between -1 and 1.


NETWORK ANALYSIS AND MINING
Which Partition Is Providing Optimum Modularity ?

A.-L. Barabási, Network Science: Communities.


Louvain Method For Community Detection
Graph Theory And its Applications
Louvain method by Blondel et al.

• Louvain method written by Blondel et. al. Louvain method is still


considered to be one of the fastest disjoint community
detection technique.
• We use the same definition of Q as In Newman’s Fast
Algorithm
which is

• But uses an even faster greedy optimization than CNM


algorithm
Graph Theory And its Applications
Louvain Algorithm Vs. Clauset Newman Moore
⮚The Louvain algorithm is a greedy algorithm that is very similar to
the Clauset-Newman-Moore (CNM) Algorithm.
⮚The initialization is the same i.e. each node is a community to start
with.
CNM Louvain
• The pair of communities that • A single node is moved from one
maximize the increase in modularity community to another.
are combined.
• The community aggregation
• No community aggregation step, stage is introduced.
and continually combine pairs of
communities that maximize the
increase in modularity until we can
no longer combine communities.
Graph Theory And its Applications
Louvain method by Blondel et al.

• Louvain Algorithm consists of 2 phases:

1st Phase: Modularity optimization to detect community


2nd Phase: Community aggregation
Graph Theory And its Applications
Louvain method by Blondel et al.

• First phase (Modularity optimization to detect community )


1. Assign each node to it's own community.

1. Iterate over each node, calculating the change in modularity that


would occur if it were removed from it's current community and put
in a connected community. Essentially for every node, every
neighboring node is considered.

1. Move it to the community that produces the biggest increase in


modularity.

1. Repeat step 2 until we can't increase modularity anymore.


NETWORK ANALYSIS AND MINING
Louvain method by Blondel et al.

• Second phase (Community aggregation ):


• Super nodes are created to represent each detected community in
first phase and create a new network.
• The edge weight between the nodes representing two
communities is just the sum of the edge weights between the
nodes of community 1 and community2 for directed graph and edge
count for undirected graph. This step also generates self-loops
which are the sum of all links inside a given community,
before being collapsed into one node.
• Perform the first phase on this new network. That is, we're
calculating communities of communities.
• We then repeat these two phases until no further change in
communities is observed
Graph Theory And its Applications
Louvain Algorithm

The Louvain algorithm starts from a singleton


partition in which each node is in its own
community
(a). The algorithm moves individual nodes
from one community to another to find a
partition
(b). Based on this partition, an aggregate
network is created
(c). The algorithm then moves individual nodes
in the aggregate network
(d). These steps are repeated until the quality
cannot be increased further.
Louvain Algorithm Example from Paper

Links of node 0 inside green community: 3


Links of node 1 inside green community: 2
Links of node 2 inside green community: 4
Links of node 4 inside green community: 3
Links of node 5 inside green community: 2

Total number of
Graph Theory And its Applications
Louvain Algorithm Example from Paper

• We started off with separate communities for each node


• After iterating over nodes & calculating modularity by
changing communities for nodes, we finally got 4
communities (Red, Blue, Sky Blue & Green)
• In the new graph formed, we now have 4 nodes
(representing the 4 communities found) with edge weights
as aggregation .
• Again the entire cycle of finding communities using
Modularity starts in this new graph now where we are able
to club these 4 communities into 2 )
• As no further communities are found, therefore we end
up with 2 communities.
SOCIAL NETWORK ANALYTICS
Community Detection: Louvain Algorithm

⮚ The method is a greedy optimization method that attempts


to optimize the "modularity" of a partition of the network.

⮚ The exact computational complexity of the method is not


known, the method seems to run in time O(n log n) with
most of the computational effort spent on the optimization
at the first level.
SOCIAL NETWORK ANALYTICS
Louvain Algorithm Example from Paper
SOCIAL NETWORK ANALYTICS
Louvain Algorithm Example from Paper

ΔM02=1/2L ( 2L02 - (K0 K2)/L) = i/2L(2.1- (4 *5)/2L)

ΔM03=1/2L ( 2L03 - (K0 K3)/L) = i/2L(2.1- (4 *2)/2L)

ΔM04=1/2L (2 L04 - (K0 K4)/L) = i/2L(2.1- (4 *4)/2L)

ΔM05=1/2L ( 2L05 - (K0 K5)/L) = i/2L(2.1- (4 *4)/2L)

Clearly, ΔM03 is the highest, Choose 3 to connect with 0

Please note that the equation for Modularity is the same as the original, but it is slightly modified.
Note: 1. L remains the same for all trials. So there’s no need to explicitly substitute the value of L
2. In each trial we calculate the modularity of proposed community and see which community gets better modularity.
SOCIAL NETWORK ANALYTICS
Louvain Algorithm Example from Paper

0-3 - is now a part of the community B,

Proceed with node 1


SOCIAL NETWORK ANALYTICS
Louvain Algorithm Example from Paper

ΔM12=1/2L ( 2L12 - (K1 K2)/L) = 1/2L(2.1- (4 *5)/L)

ΔM17=1/2L ( 2L17 - (K1 K7)/L) = 1/2L(2.1- (4 *4)/L)

ΔM14=1/2L ( 2L14 - (K1K4)/L) = 1/2L(2.1- (4 *4)/L)

Modularity gain with 1 and 7 are the same and highest


Choose 4
SOCIAL NETWORK ANALYTICS
Louvain Algorithm Example from Paper

Proceed with node 2

Node 2
is connected to community red
is connected to community blue
is connected to node 6
is connected to node 5
SOCIAL NETWORK ANALYTICS
Louvain Algorithm Example from Paper

ΔM2R=1/2L ( 2L2R - (K2 KR)/L) = 1/2L(2.2- (4 *(3+4))/L)


= 1/2L(4- (28/L))

ΔM2B=1/2L ( 2L2B - (K2 KB)/L) = 1/2L(2.1- (4 *(4+2))/L)


= 1/2L(2- (24))/L)

ΔM25=1/2L ( 2L25 - (K2K5)/L) = 1/2L(2.1- (4 *4)/L)


= 1/2L(2- (16)/L)

ΔM26=1/L (2 L26 - (K2K6)/L) = 1/2L(2.1- (4 *3)L)


= 1/2L(2- (12)L)

Highest modularity corresponds to R


So, 1,2,4 become a new community R
SOCIAL NETWORK ANALYTICS
Louvain Algorithm Example from Paper

Proceed with Node 3

ΔM30=1/2L ( 2L30 - (K3K0)/L) = 1/L(2.1- (2 *4)/L)


ΔM37=1/2L ( 2L37 - (K3K7)/L) = 1/L(2.1- (2 *4)/L)

Both are same.


3-0 are already a community .
No Change

Proceed with Node 4


No Change here also as the least degree node
connected to Node 4 is one and 1 and 4 are
already in community R
SOCIAL NETWORK ANALYTICS
Louvain Algorithm Example from Paper

This is how the communities look


at the end of iteration 1

Combine Communities into super nodes


SOCIAL NETWORK ANALYTICS
Louvain Algorithm Example from Paper

This is how the communities look


at the end of iteration 1

Repeat iterations until there’s no change in


the structure of the communities
Evaluation of communities
Sujatha R Upadhyaya
Department of Computer Science and Engineering
Graph Theory And its Applications
How to evaluate ?

When we are given objects of two different kinds, the


perfect communities would be the case when objects
of the same type are in the same community.

• The communities here are shown with True label of members


• Evaluation with ground truth ( some test data is there)
• Evaluation without ground truth
Graph Theory And its Applications
Evaluation with the ground truth

• When ground truth is available, we have at least partial


knowledge of what communities should look like.
• We are given the correct community (clustering)
assignments.
• Measures
• Precision and Recall, or F-Measure
• Purity
Graph Theory And its Applications
Purity

• In purity, we assume the majority of a community


represents the community
• The purity is then defined as the fraction of
instances that have labels equal to the
community’s majority label

where k is the number of communities, N is


the total number of nodes, Lj is the set of
instances with label j in all communities, and
Ci is the set of members in community i.
Graph Theory And its Applications
Purity is not a Precise Measure always

• Purity can be easily manipulated to generate high


values;
• consider when nodes represent singleton
communities (of size 1)
• when we have very large pure communities
(ground truth = majority label).
• In both cases, purity does not make sense because it
generates high values.
Graph Theory And its Applications
Precision and Recall

Community detection can be


considered a problem of
assigning all similar nodes
to the same community.
• True Positive (TP) :
• when similar points are assigned to the same communities In the simplest case, any
• This is considered a correct decision. two similar nodes should
• True Negative (TN) : be considered members of
• when dissimilar points are assigned to different communities the same community.
• This is considered a correct decision
• False Negative (FN) :
• when similar points are assigned to different communities
• This is considered an incorrect decision
• False Positive (FP) :
• when dissimilar points are assigned to the same communities
Graph Theory And its Applications
Precision and recall

For TP, we need to compute the # of similar pairs that


are in the same community.

For FP, we need to compute dissimilar pairs that are in


the same community.

For FN, we compute the similar pairs that are in


different communities.

For TN, we compute the number of dissimilar pairs in


the different communities.
Graph Theory And its Applications
Precision and recall
Graph Theory And its Applications
Precision and Recall
Graph Theory And its Applications
Precision and Recall
Graph Theory And its Applications
Evaluating Without Ground Truth - with semantics

• A simple way of analyzing detected communities is to analyze


other attributes (posts, profile information, content
generated, etc.) of community members to see if there is a
coherency among community members

• For example, if there is text data as attribute available for each node,
to help analyze these communities, one can use word frequencies, do
word cloud or do topic model or do key word / key phrase extraction.

• These things may be considered as better attributes


Graph Theory And its Applications
Evaluating Without Ground Truth - with Clustering Quality Measures

• We can use the usual clustering quality measures as well,


specifically intrinsic measures such as Silhouette
Coefficient, inter and intra cluster similarity

• But they are not always very effective


Graph Theory And its Applications
Intrinsic Measure for Clustering Quality : Silhouette Coefficient
▪ Silhouette Coefficient or silhouette score is a metric
used to calculate the goodness of a clustering technique.
Its value ranges from -1 to 1.
• 1 Means clusters are well apart from each other and
clearly distinguished.
• 0: Means clusters are indifferent, or we can say that
the distance between clusters is not significant.
• -1: Means clusters are assigned in the wrong way.

Silhouette Score = (b-a)/max(a,b) where


• a= average intra-cluster distance i.e. the average
distance between each point within a cluster.
• b= average inter-cluster distance i.e. the average
distance between all clusters.
THANK YOU

Sujatha R Upadhyaya
Department of Computer Science and Engineering
GRAPH THEORY AND ITS APPLICATIONS

Real world networks’ properties


to be modeled
S Upadhyaya
Department of Computer Science
and Engineering

These slides are the modified versions of the slides prepared by Dr. Bhaskarjyoti Das for the course “Network
mining and Analysis” with additional inputs from Dr. Arti Arya
GRAPH THEORY AND APPLICATIONS

Why generative models ?

S Upadhyaya
Department of Computer Science and Engineering
GRAPH THEORY AND APPLICATIONS
Why are network models necessary ?

• In may 2011, Facebook had 721 millions users. A Facebook user


at the time had an average of 190 friends -> a total of 68.5
billion friendships
• In social media there are many networks with millions of nodes
and billions of edges.
• They are complex and it is difficult to analyze them
GRAPH THEORY AND APPLICATIONS
What we do with models ?

• We design models that generate, on a smaller scale, graphs similar


to real-world networks.
• The goal is to accurately model properties observed in real-world
networks so that the analysis of real-world networks boils down to
a cost-efficient measuring of different properties of simulated
networks !
• How does it help if it successfully simulates ?
• Allow for a better understanding of phenomena observed
• Allow for controlled experiments on synthetic networks when real-world
networks are not available.
GRAPH THEORY AND APPLICATIONS
Observed Properties of Real World Networks

• These properties are consistently observed in real-world


networks.
• Small Average Path length
• Power Law degree distribution
• Scale Free and Fat Tailed
High clustering coefficient

• Real world networks also have Giant Components
• Generative Models simulate these mechanisms that drive
the network formation
GRAPH THEORY AND APPLICATIONS
What is on the menu ?

• Empirical network features:


• Power-law (heavy-tailed) degree distribution (Scale Free nature)
• Small average distance (graph diameter)
• Large clustering coefficient (transitivity)
• Giant connected component, hierarchical structure etc.

• Generative Models
• Random graph model (Erdos & Renyi, 1959)
• “Small world” model (Watts & Strogatz, 1998)
• Preferential attachment model (Barabasi & Albert, 1999)
GRAPH THEORY AND APPLICATIONS

Properties : Small Average Path Length

S Upadhyaya
Department of Computer Science and Engineering
GRAPH THEORY AND APPLICATIONS
Kevin Bacon game

https://oracleofbacon.org/how.php

Distance between Amitabh Bachan and Kevin Bacon


Mystic River (2003)

Tim Robbins
Code 46 (2003)

Om Puri
Yuva (2004)

Rani Mukherjee
Black (2005)

Amitabh Bachchan
GRAPH THEORY AND APPLICATIONS
Mr. Bachchan currently has a bacon number 2

• Started with Six degrees of Kevin Bacon meme ( nobody in Hollywood is more than
6 hops away from Kevin Bacon ('Footloose’)
• Google introduced Six Degrees of Kevin Bacon calculator years ago. The calculator
tells you how many contacts away an actor is from the famed Kevin Bacon .
• Amitabh Bachchan's Bacon number is 2. Amitabh Bachchan and Helena Bonham
Carter appeared in 'Shantaram’. Helena Bonham Carter and Kevin Bacon appeared
in 'Novocaine'.
• Irrfan Khan's Bacon number is 2. Irrfan Khan and Campbell Scott appeared in 'The
Amazing Spider-Man’. Campbell Scott and Kevin Bacon appeared in 'Loverboy'.
• Anil Kapoor's Bacon number is 2. Anil Kapoor and Tom Cruise appeared in 'Mission:
Impossible - Ghost Protocol’.
Tom Cruise and Kevin Bacon appeared in 'A Few Good Men'.
GRAPH THEORY AND APPLICATIONS
Erdos number

Number of links required to connect scholars to


Erdős, via co-authorship of papers
Paul Erdős (1913-1996)
Erdős wrote 1500+ papers with 507 co-authors.

Jerry Grossman’s (Oakland Univ.) website allows


mathematicians to compute their Erdos
numbers:

http://www.oakland.edu/enp/

Connecting path lengths, among mathematicians


only:
• average is 4.65
• maximum is 13
GRAPH THEORY AND APPLICATIONS
Stanley Milgram’s Experiment – Six Degrees of Separation

• Random people from Nebraska were


asked to send a letter (via
intermediaries) to a stock broker in
Boston

• S/he could only send to someone with


whom they were on a first-name basis

Among the letters that reached the


target, the average path length was
six.
GRAPH THEORY AND APPLICATIONS
Average shortest path

• In real-world networks, any two members of the network


are usually connected via short paths - the average path
length is small
• Six degrees of separation
• Stanley Milgram In the well-known small-world experiment conducted
in the 1960’s conjectured that people around the world are connected
to one another via a path of at most 6 individuals
• Four degrees of separation
• Lars Backstrom et al. in May 2011, the average path length between
individuals in the Facebook graph was 4.7. (4.3 for individuals in the
US)
• Below is an old measurement
GRAPH THEORY AND APPLICATIONS

Properties to be modeled :

Power Law Degree distribution

S Upadhyaya
Department of Computer Science and Engineering
GRAPH THEORY AND APPLICATIONS
Power Law Distribution

Power law distributions:

Observed in numerous natural systems, indicate the ability of a


system to self-organize when constantly pushed to a disordered
state by natural perturbations

Networks that observes Power Law is also known as scale free


networks

An example power-law graph that demonstrates ranking of popularity.


To the right is the long tail
To the left are the few that dominate (also known as the 80–20 rule)
GRAPH THEORY AND APPLICATIONS
Think of distribution of degrees

• Consider the distribution of wealth among individuals.


• Few Bill Gates and Ambanis.
• Similarly, consider the population of cities.
• Very few Mumbai and New York.
• In social media, we observe the same phenomenon regularly
when measuring popularity or interestingness for entities.
• Compare your popularity vs. that of Shahrukh Khan (;-
GRAPH THEORY AND APPLICATIONS
Think of distribution of degrees

• Examples from internet world ( skewed popularity)


• Many sites are visited less than a 1,000 times a month whereas a
few are visited more than a million/billion times daily.
• Most social media users are often active on a few sites whereas
few individuals are active on hundreds of sites.
• There are exponentially more modestly priced products for sale
compared to expensive ones.
• There exist many individuals with a few friends and a handful of
users with thousands of friends.
• Point to ponder :
• Google’s Adword business model relies on millions of small
websites rather than few big.
• Business model (cloud based) has changed from “head” to “tail”.
GRAPH THEORY AND APPLICATIONS
Zipf’s law, Pareto law and Power law

• Intuitively, power law distribution are similar to Zipf’s law and Pareto’s :aw
• Zipf’s law and Pareto both look at the same thing in a different way
• Zipf’s law is produced by ranking variable
• Pareto’s produced by looking at the distribution of frequency → 80% of the
outcome is due to 20% of the causes
• Cumulative Distribution with a power law resembles Pareto and Zipf’s law
GRAPH THEORY AND APPLICATIONS
Pareto law and Power Law
• Pareto Law is also called 80-20 rule
• Merely an observation (it may be 70-20 !) and not a rule
• Essentially means 20 % causes decides the 80% of effects
• Examples : 20% of population own 80% of the wealth, 20% of world’s
rivers carry 80% of world’s river water, 20% of the bugs can decide 80% of
the software performance ( bug triaging is a process to detect that 20%)
• It also means things in life are not distributed uniformly . Pareto
distribution (by Dr. Juran ) is a skewed, heavy-tailed distribution that is
sometimes used to model that distribution of incomes.
• Pareto law is in terms of CDF( cumulative distribution function) i.e. no of
events larger than x is an inverse power k of x ( it was devised for
income distribution)
GRAPH THEORY AND APPLICATIONS
Zipf’s law

1. Zipf’s law : given some corpus of natural


language utterances, the frequency of any word is inversely
proportional to its rank in the frequency table i.e. y ~ r-b
1. Zipf’s law refers to size of an occurrence with respect to its rank
2. Thus the most frequent word will occur approximately twice as
often as the second most frequent word, three times as often as
the third most frequent word etc
GRAPH THEORY AND APPLICATIONS
Power law distribution
GRAPH THEORY AND APPLICATIONS
Expressing a power law distribution

• When the frequency of an event changes as a negative


power of an attribute -> the frequency follows a
power-law
• Let p(k) denote the fraction of individuals having
degree k.

b: the power-law exponent and its value is typically in the range of [2, 3]
a: power-law intercept
GRAPH THEORY AND APPLICATIONS
Power law distribution of degree

• Many real-world networks exhibit a A typical shape of a power-law distribution

power-law distribution.
• Power laws seem to dominate in
cases where the quantity being
measured can be viewed as a type of
popularity.
• A power-law distribution implies that
Log-Log plot
small occurrences are common,
whereas large instances are extremely
rare
GRAPH THEORY AND APPLICATIONS
How to test for existence of power law ?

• Pick a popularity measure and compute it for the whole


network. For instance, we can take the number of friends
in a social network
• Compute p(k), the fraction of individuals having
popularity k.
• Plot a log-log graph, where the x-axis represents ln k and
the y-axis represents ln p(k).
• If a power-law distribution exists, we should observe a
straight line
• If it does not, it does NOT look like a network with a
power law (a real life network) !
GRAPH THEORY AND APPLICATIONS
Power Law in Degree Distribution in Real World Social Graphs
GRAPH THEORY AND APPLICATIONS

Scale Free and Fat Tailed …

S Upadhyaya
Department of Computer Science and Engineering
GRAPH THEORY AND APPLICATIONS
Scale free ?

• A scale-free network is one with a power-law degree


distribution
• Networks with power-law distributions are called scale-
free because power laws have the same functional form at all
scales i.e. remains unchanged other than a multiplicative factor
when rescaling the independent variable k
pk = a(k)-b
Rescaling k with some constant c, we get
pk= a.(ck)-b
pk =(a. c-b) . k-b
= a’ .k-b
GRAPH THEORY AND APPLICATIONS
Scale free networks examples

• Several networks are claimed to be scale-free


• World wide web
• Social networks, including collaboration networks. Two examples
that have been studied extensively are the collaboration of movie
actors in films and the co-authorship by mathematicians of papers.
• Some financial networks such as interbank payment networks
• Protein-protein interaction networks.
• Semantic networks
• Airline networks.
GRAPH THEORY AND ITS APPLICATIONS
Scale free networks are also fat tailed network

• We call a network fat tailed if


its degree distribution follows
power law and a tail in the
high-k region. ( certain nodes
with high value than k).

• Outliers, or exceptionally high-


degree nodes, are not only
allowed but are expected in
these networks
GRAPH THEORY AND ITS APPLICATIONS
Scale free networks are also fat tailed network

• Scale-free networks are a type


of network where large hubs
are present.
• A hub is a node with a number of
links that greatly exceeds the
average.
• Also known as heavy tails, fat
tails describe the greater than
expected probabilities of
extreme values.
• If in a Gaussian distribution there
is, say, a 1% chance of a quantity
taking values greater than some
extreme value, this probability
will be higher in a fat-tailed
distribution.
GRAPH THEORY AND ITS APPLICATIONS
Scale free networks (summary)

Random Network Scale Free Network ● Scale-free network follows


power-law and is
inhomogeneous.
● Most nodes have one or
two links but a few highly-
connected nodes, so-
called hubs,(have a large
number of links).
● Example
○ The airline network,
● Random network follows follow scale-free
Poisson distribution and is nearly network. White circles
homogenous. indicate nodes and
● Most nodes have approximately dark ones indicate hubs
the same numbers of links. The that are highly
road system, for example, fits connected nodes.
with this type of network model.
GRAPH THEORY AND ITS APPLICATIONS
Scale free network properties

1. A scale-free network
• A network whose degree distribution follows a power law, at least
asymptotically.
• The fraction p(k) of nodes in the network having k connections to other nodes is
■ p(k) = a. k -b
■ where b is a parameter in the range of 2 and 3 typically & a > 0 typically

1. Another important characteristic of scale-free networks is


the clustering coefficient distribution, which decreases as the node
degree increases.
2. This distribution also follows a power law.
1. This implies that the low-degree nodes belong to very dense sub-graphs
2. Interpretation : those sub-graphs are connected to each other through hubs as
most scale free networks are heavy or fat tailed.
GRAPH THEORY AND ITS APPLICATIONS
Scale free networks – other properties

• Scale-free networks also exhibit small-world phenomena


• For a random graph having the same power law distribution as
the Web graph, it has been shown that
• Avg path length = 0.35 + log10 N

• Scale-free networks tend to be more brittle


• You can drastically reduce the connectivity by deliberately
removing a few nodes, specially the hubs
• This can also be seen as an opportunity..
• Disease prevention by quarantining super-spreaders
GRAPH THEORY AND APPLICATIONS

Properties to be modeled :

High Clustering Coefficient

S Upadhyaya
Department of Computer Science and Engineering
GRAPH THEORY AND APPLICATIONS
Large Local Clustering Coefficient

• In real world social graphs, friendships are highly transitive


• Triadic Closure, Focal Closure and Membership Closure are
common leading to triad formation
• Triad formations result in high Local Clustering Coefficient
GRAPH THEORY AND APPLICATIONS

Giant Component…

S Upadhyaya
Department of Computer Science and Engineering
GRAPH THEORY AND APPLICATIONS
Giant Components

• What are the component sizes in a real-world network?


▪ Typically there is a large/giant component that fills most of the network
✔ Even more than 90% of the nodes
▪ Rest of the network is divided in many smaller components disconnected
from each other

• This large components can arise


either due to the nature of the net-
work (e.g., Internet), or due to the
way the network was measured
(e.g., Web)
GRAPH THEORY AND APPLICATIONS
Generative Models

• In the next few lectures we study about the following Generative


Models
▪ Random Graph Model
▪ Small World Model (Watt’s Strogatz Model)
▪ Preferential Attachment Model (Barabasi Albert Model)
THANK YOU

S Upadhyaya
Department of Computer Science and Engineering
[email protected]
Graph Theory and its Applications

Random Graph Models

S Upadhyaya
Department of Computer Science
and Engineering
Graph Theory and its Applications

Erdos Renyi random graph model

S Upadhyaya
Department of Computer Science and Engineering
Graph Theory and its Applications
Basic assumption

• We start with the most basic assumption on how friendships are


formed.
Random Graph’s main assumption:
Edges (i.e., friendships) between nodes (i.e.,
individuals) are formed randomly.

• We will discuss two random graph models


○ G(n,p) model
○ G(n,m) model
Graph Theory and its Applications
Erdos Renyi G(n,p) model

• Formally, we can assume that for a graph with a fixed number of


nodes n, any of the edges can be formed independently,
with probability p.
• This graph is called a random graph and we denote it as G(n, p)
model
• C(n, 2) or is # of combinations of two objects from a set of n
objects
• No of edges m are not fixed !
Graph Theory and its Applications
Modeling real world network with random graph

● We have a real network where we know


○ The number of nodes (n)

○ The degree distribution.

● We can compute the average degree c from the distribution


● We can then compute p, by using “expected degree of a
node” formula p= c/(n-1)
● We can then generate the random graph. Using p and the
number of nodes in the given network n, a random graph
model G(n, p) can be simulated.
Graph Theory and its Applications
Erdos Renyi random graph G(n,m) model

• Another way is to assume both number of nodes n and number of


edges m are fixed.
• However, we need to determine which m edges are selected from
the set of possible edges

• Let denote the set of graphs with n nodes and m edges


• There are |Ω| different graphs with n nodes and m edges

• To generate a random graph, we uniformly select one of the |Ω|


graphs (the selection probability is 1/|Ω|)
This model proposed first by Paul Erdos and Alfred Renyi
Graph Theory and its Applications
Probability of observing m edges in G(n,m) graph

Given the G(n, m) process, the probability of observing m edges is binomial


distribution

• Proof:
• m edges are selected from the possible edges.

• These m edges are formed with probability pm ( prob (1 edge)=p, prob (2 edges)=p2 etc.)
• other edges are not formed (to guarantee the existence of only m edges) with
probability
Graph Theory and its Applications

Properties of Random Graph Models

S Upadhyaya
Department of Computer Science and Engineering
Graph Theory and its Applications
Properties of Random Graphs

● Following Properties of Random Graph are discussed


○ Expected Degree
○ Expected number of Edges
○ Probability of observing nodes of Degree D
○ Degree Distribution
○ Average Length Path
○ Clustering Coefficient (Local and Global)
● These properties are discussed with reference to G(n, p) model as it
is a simpler and more generic model
Graph Theory and its Applications
Expected degree a node in G(n.p) model

The expected degree c is nothing but,


The expected number of edges connected to a node in
G(n, p) graph is
c=(n - 1)p
• A node can be connected to at most n-1 nodes (or n-1 edges)
• All edges are selected independently with probability p
• Therefore, on average, (n - 1)p edges are selected

• c=(n-1)p or equivalently,
Graph Theory and its Applications
Expected number of edges in a G(n,p) graph

• The expected number of edges in G(n, p) is p

• Proof:
• Since edges are selected independently, and we have a maximum edges,
the expected number of edges is = p
Graph Theory and its Applications
Probability of observing degree d

• When computing degree distribution, we estimate the probability of


observing degree d of node v (dv ) i.e. P(dv = d)
• For a random graph generated by G(n,p) this probability is (binomial)

• Each node has (n-1) nodes to form edges and the probability is p for
each
Graph Theory and its Applications
Degree distribution in a random graph

• In a Erdos-Renyi (uniform) Random Graph with n nodes, the probability that a node has
degree k is given by

• As n->infinity, this becomes a Poisson distribution (where λ is the mean degree and is
equal to pn, for large n and small p )

• Note that Poisson decays exponentially while power law decays polynomially ( there
is a difference)
• Polynomial ( i.e. x 5) – variable raised to some constant power ; Exponential (i.e. 5x)– variable is
the exponent
Graph Theory and its Applications
Average Path Length in Random Graph Model

• Let D denote the expected diameter size in the random graph.


• Starting with any node in a random graph and its expected degree c, one can
visit approximately c nodes by traveling one edge,
○ c2 nodes by traveling two edges

○ cD nodes by traveling “diameter” number of edges.


• After this step, almost all nodes should be visited.

• In Random Graph, the expected diameter size tends to be average shortest path
length in the limit (proof excluded) . So, we have the 2nd expression

• Taking logarithm of both sides, we have final expression


Graph Theory and its Applications
Local clustering coefficient of random graph

• The expected local clustering coefficient for node v of a random graph


generated by G(n, p) is p
• That is intuitive if we consider the expected no of connections
CC = no of edges/ no of all possible edges
• The numerator of CC = p * n-1C2
• The denominator is n-1C2
Graph Theory and its Applications
Global clustering coefficient of a random graoh

• The global clustering coefficient of a random graph generated by G(n, p) - p


• The global clustering coefficient of a graph
○ average probability of two neighbors of the same node being connected.

• In random graphs, for any two nodes, this probability is the same and is equal
to the generation probability p that determines the probability of two nodes
getting connected.
• Note that in random graphs
○ expected local clustering coefficient is equivalent to the global clustering
coefficient.
Graph Theory and its Applications
Properties of the Generative Model G(n,p) - Summary

● Expected Degree
○ c=(n - 1)p
● Expected number of Edges
○ p
● Probability of observing nodes of Degree D

● Degree Distribution
○ Same as above where k takes values 1 to n-1
Graph Theory and its Applications
Properties of the Generative Model G(n,p) - Summary

● Average Length Path

● Clustering Coefficient (Local and Global)


○ p
Graph Theory and its Applications
G(n,p) vs. G(n,m)

• In the limit (when n is large), both models (G(n, p) and G(n, m))
act similarly
• The expected number of edges in G(n, p) is
• We can set and in the limit, we should get similar results.

Differences:
• The G(n, m) model contains a fixed number of edges
• The G(n, p) model is likely to contain none or all possible edges
Graph Theory and its Applications

Evolution of Random Graph Models

S Upadhyaya
Department of Computer Science and Engineering
Graph Theory and its Applications
Giant component formation : an example with increasing p for 10 nodes

average degree diameter size , size of the largest average path


c ds component slc
Probability (p)
length l
0.0 0.055 0.11 1.0

Average node 0.0 0.8 ~1 n-1 = 9


degree (c)
Diameter (ds) 0 2 6 1
Giant 0 4 7 10
component
size (slc)
Average path 0.0 1.5 2.66 1.0
length (l)
Graph Theory and its Applications
With small p

1. At p = 0, there are no components


2. As probability p is small ( p = 0.0555)
1. No giant component is observed in the graph.
2. Small isolated components are formed.
3. The diameter is small because all nodes are in isolated components, in which
they are connected to a handful of other nodes.
Graph Theory and its Applications
With large p =0.11

• Large p (0.11)
• A giant component starts to appear.
• Isolated components become connected.
• The diameter values increase ( nodes are connected to each other via
long paths)
Graph Theory and its Applications
With very large p near 1.0

• For very large value of p, the diameter shrinks as nodes can get
connected by shorter paths ( more paths being available)
• The point where diameter value starts to shrink in a random graph is
called phase transition.
• In a random graph, phase transition happens when average node
degree, c = 1, or when p = 1/(n-1)

At the point of Phase Transition,


• The giant component that just started to appear, starts to grow, and
then the diameter that just reached its maximum value, starts
decreasing.
Graph Theory and its Applications
Shortcomings of high value of p in random graph model

• In random graphs, the local and global clustering coefficient is


equal to the probability p
• By appropriately selecting p, we can generate networks with a
high clustering coefficient.
• Note that selecting a large p is undesirable because doing so
will generate a very dense graph, which is unrealistic, as in the
real-world, networks are often sparse.
• Thus, random graphs are considered generally incapable of
generating networks with high clustering coefficients without
compromising other required properties.
Graph Theory and its Applications
How good is the random graph model ?

*C is the average clustering coefficient


How good is the model?

• Random graphs perform well in modeling the average path lengths;


• However, when considering the transitivity, the random graph model
drastically underestimates the clustering coefficient.
Graph Theory and its Applications
Random graph (Poisson) vs. scale free
The main difference between a random and a scale-free network comes in the
tail of the degree distribution, representing the high-k region of pk.

• For small k (<5), the power law is above the


Poisson function, indicating that a scale-free
network has a large number of small degree
nodes, most of which are absent in a random
network.
• For moderate k (10 appox), in the vicinity of some
value 〈k〉 the Poisson distribution is above the
power law, indicating that in a random network
there Log anplotexcess of nodes with degree k≈〈k〉
is log
which are in the middle range .
The most notable characteristic in a scale-free network is the relative commonness of vertices with a degree that
greatly exceeds the average. The highest-degree nodes are often called "hubs“.
Graph Theory and its Applications
Random graph (Poisson) vs. scale free

• For large k, the power law is again above the


Poisson curve. The difference is particularly
visible if we show pk on a log-log plot indicating
that the probability of observing a high-degree
node, or hub, is several orders of magnitude
higher in a scale-free than in a random network.

The most notable characteristic in a scale-free network is the relative commonness of vertices with a degree that
greatly exceeds the average. The highest-degree nodes are often called "hubs“.
Graph Theory and its Applications
Disruption in scale free vs. random graph

• Disruption
• A random percentage of the nodes are removed
• How does the diameter change?
• Increases monotonically and linearly in random graphs
• Remains almost the same in scale-free networks
• Since a random sample is unlikely to pick the high-degree nodes
Graph Theory and its Applications
Attack in scale free vs. random graph

• Attack
• A percentage of nodes are removed willfully (e.g. from
high degree in decreasing order of connectivity)
• How does the diameter change?
• For random networks, essentially no difference from
disruption as all nodes are approximately same
• For scale-free networks, diameter doubles for every
5% node removal!
• This is an opportunity when you are fighting to
contain spread of an epidemic
Graph Theory and its Applications
Summary

• The assumption behind the random graph model is that


connections in real-world networks are formed at random.
• Although unrealistic assumption, random graphs can model
average path lengths in real-world networks properly
• It underestimate the clustering coefficient.
• This degree distribution also falls off faster than an exponential
in d, hence it is not a power-law distribution. This is because it
is essentially a Poisson distribution
• To tackle this issue (underestimates the clustering coefficient),
we have the small-world model !
THANK YOU

S Upadhyaya
Department of Computer Science and Engineering
[email protected]
GRAPH THEORY AND APPLICATIONS

Watts and Strogatz Small World


Model
S Upadhyaya
Department of Computer Science
and Engineering

These slides are the modified versions of the slides prepared by Dr. Bhaskarjyoti Das for the course “Network
mining and Analysis” with additional inputs from Dr. Arti Arya
GRAPH THEORY AND APPLICATIONS

Watts and Strogatz Small World Model

S Upadhyaya
Department of Computer Science and Engineering
GRAPH THEORY AND APPLICATIONS
Small World Model

• Small-world Model also known as the Watts and Strogatz model is


a special type of random graphs with small-world properties,
including:
• Short average path length
• High clustering.
• It was proposed by Duncan J. Watts and Steven Strogatz in their
joint 1998 Nature paper
GRAPH THEORY AND APPLICATIONS
Basic assumption

• In real world, many individuals have limited /fixed connection and


they don’t randomly connect with others!
• However, in real world, most people have a similar fixed set of
connections ( parents, siblings, teachers , students etc.)
• So, an egalitarian assumption (all are equal) : all have same
number of connections !
• Unrealistic assumption but probably helps simulate the clustering
coefficient of real life network better !
• In graph theory it means embedding individuals in regular
network
• A regular (ring) lattice is a special case of regular networks where
there exists a certain pattern for how ordered nodes are
connected to one another.
GRAPH THEORY AND APPLICATIONS
The way it is done ..

• The small-world model posits a network built on a low-


dimensional regular lattice (capturing geographic or other type
of social proximity), and then adding or moving random edges
to create a low density of “shortcuts” that join the remote parts
of the lattice to one another.
• The best studied case
○ a one-dimensional lattice with periodic boundary conditions,
i.e., a ring.
GRAPH THEORY AND APPLICATIONS
Proximity modelled in a regular lattice

• Regular networks are "regular" because each node


has exactly the same number of links. Regular
networks are highly ordered.
• In particular, in a regular lattice of degree c, nodes
are connected to their previous c/2 and following
c/2 neighbors.
• Formally, for node set ,
an edge exists between node i and j if and only if
GRAPH THEORY AND APPLICATIONS
Regular ring lattice

• We consider a ring with n nodes and join each node to


its neighbors k or fewer hops (lattice spacings) away.
• Each node is "clustered" (connected) to four near
neighbor nodes.
• For example, nodes 1,2,3,10, and 9 form a cluster because
2,3,10, and 9 all connect to node #1.
• Here no of hops = 2
• Two nodes placed on opposite sides of the circle lattice
(see nodes #1 and #6) are members of separate
clusters that do not intersect.
• Two nodes that are within three nodes of each other
on the circle (nodes #1 and #4) belong to separate but
intersecting clusters.
GRAPH THEORY AND APPLICATIONS
Rewiring of the links

Rewiring replaces an existing edge


between nodes vi and vj with a non-existing
edge between two nodes with probability
β.

In other words, an edge is disconnected


from one of its endpoints and connected
to a new endpoint.
GRAPH THEORY AND APPLICATIONS
Interpretation of parameter beta

β=0 β = 0.125 β=1

People know People know People know


their neighbors. their neighbors, others at
and a few distant people. random.

Clustered, but Clustered and Not clustered,


not a “small world” “small world” but “small world”
GRAPH THEORY AND APPLICATIONS
Parameters

There are three parameters to the Watts-Strogatz model.


1. N is the number of nodes in the graph you want to
simulate.
2. K is the degree of each node at the initial step of the
algorithm.
3. β is the probability of randomly rewiring each edge in
the second step of the algorithm.
GRAPH THEORY AND APPLICATIONS
Summarizing the steps

1. The Initial Step in the Watts-Strogatz model is to start with N nodes.


Place them in a "ring."
2. Connect every node to its K neighbors (K/2 on each side). This is
called a "ring lattice" on N nodes with degree K. This creates NK
edges.
3. Next is the Randomization Step, where you randomly rewire each
edge with probability p such that self-connections and duplicate
edges are excluded.
• The rewiring procedure involves going through each edge in turn,
and with probability p, moving one end of that edge to a new
location chosen uniformly at random from the lattice.
• This finally creates nkp shortcuts.
GRAPH THEORY AND APPLICATIONS
The algorithm
GRAPH THEORY AND APPLICATIONS
Randomness in the model

• In the small-world model, we assume a parameter that


controls randomness in the model.
• The model starts with a regular lattice and starts adding
random edges based on β.
• The 0 < β< 1 controls how random the model is.
• When is β =0, the model is basically a regular lattice
• when β = 1, the model becomes a random graph.
GRAPH THEORY AND APPLICATIONS
Homophily and weak ties come back!

• Such a model follows naturally from a combination of two


basic social-network ideas:
• Homophily: the principle that we connect to others who are
like ourselves, and hence creates many triangles.
• Weak ties: the links to acquaintances that connect us to parts
of the network that would otherwise be far away, and hence
the kind of widely branching structure that reaches many
nodes in a few steps.
Graph Theory and Its Applications
A problem on Rewiring of links
Q) Consider a Watts Strogatz model with n=20, K=4 (each node has degree
4) initial nearest neighbors and rewiring probability = 0.2 . How many edges
are required in the network?

Soln) Initially each node is connected to its 4 nearest neighbors on a ring


The number of edges in network = 20 x 4 = 80 edges
With rewiring probability = 0.2, each of these 80 edges can be rewired with
prob = 0.2
Therefore, the expected number of rewired edges = 80 x 0.2 = 16
But each rewiring involves 2 edges. So, the actual number of edges which are
rewired will be
16/2 = 8 edges
GRAPH THEORY AND APPLICATIONS
Real world network and simulated graph

1. A desirable model for a real-world network should generate


graphs with high clustering coefficients and short average
path lengths.
2. In the simulated network, the average path length is small and
the clustering coefficient is high ( as expected).
3. However small-world model is incapable of generating a realistic
degree distribution (power law) in the simulated graph
THANK YOU

S Upadhyaya
Department of Computer Science and Engineering
[email protected]
Graph Theory and its Applications

Barabasi Albert (BA) Preferential


Attachment Model
S Upadhyaya
Department of Computer Science
and Engineering

These slides are the modified versions of the slides prepared by Dr. Bhaskarjyoti Das for the course “Network
mining and Analysis” with additional inputs from Dr. Arti Arya
Graph Theory and its Applications

Barabasi Albert (BA) Preferential Attachment


Model

S Upadhyaya
Department of Computer Science and Engineering
Graph Theory and its Applications
Barabasi Albert ( BA) Preferential Attachment (PA) model

• When new nodes are added to networks, they are more likely to
connect to existing nodes that many others have connected to.
• When a new user joins the network, the probability of connecting to
existing nodes is proportional to the nodes’ degree
• Unlike random graphs in which we assume friendships are formed
randomly, in the preferential attachment model we assume that
individuals are more likely to befriend gregarious others.
• Examples
• The rich get richer, aristocrat network
Graph Theory and its Applications
Basic assumption

• This is the most known generative model for power law


distribution
• Barabasi-Albert or “preferential attachment” model
• Vertices are added one by one
• The algorithm starts with a graph containing a small set of nodes m0 .
We initialize the network with m0 nodes with c edges each (c < m0)
where c is the average degree
• We then add one node at a time.
• Each node gets to connect to m other nodes where m <= m0
• Each edge is attached to a vertex i randomly with a probability
directly proportional to i’s degree ki
Graph Theory and its Applications
Constructing the model

• Graph G(V0, E) is given


• For any new node v to the graph
• Connect v to a random node vi ∈ V0, with probability
• Growth : each new node gets connected to m
other m<= m0
• Preferential attachment : Probability of
connecting to node vi

• Note, initial m0 nodes must have at least


degree 1

• Excluded here : one can form a differential


equation from here and solve that to get

• This gives the power law (scale free nature)


Graph Theory and its Applications
Constructing the Model

• Start with a graph of n nodes and with m edges


• Add a new node
• Probability that node joins a node i of degree di is given by

• Higher the value of di, higher is probability of the node joining node i
• Rich gets Richer
• Scale Free nature or Power Law is maintained
Graph Theory and its Applications
About the BA model

• The model incorporates two ingredients


• the growth element : realized by adding nodes as time goes by.
• the preferential attachment element – to achieve a scale-free network,
edges are added in a specific way.
• Removing any one of these ingredients generates networks that are not
scale-free
• Deals with undirected graph
Graph Theory and its Applications
Features of BA model

• Degree distribution that resembles a power law

• Expression for average path length(increases logarithmically with the


no of nodes in network)

• Expression for clustering coefficient ( as the edges get formed


independently, not many triangles get formed)
Graph Theory and its Applications
Real world networks and simulated graphs

• The preferential attachment model generates a realistic degree


distribution
• The preferential attachment model generates small average path
lengths;
• However the generated networks fail to exhibit the high clustering
coefficient observed in real-world networks
GRAPH THEORY AND ITS APPLICATIONS

Summarizing Generative Models

S Upadhyaya
Department of Computer Science and Engineering
Graph Theory and its Applications
Nobody is perfect (;-

Model Degree High average Small average


distribution clustering path length
(power law) coefficient
Random Graph No No Yes
model
Small world model No Yes Yes
Preferential Yes No Yes
Attachment Model

Random Graph model : only small average path length is ok


Small world model : adds in one more good thing i.e. large clustering
coefficient but degree distribution is not following power law
Preferential Attachment Model : both degree distribution and small
average path length are ok but does not generate large clustering
coefficient
Graph Theory and its Applications
Summarizing Generative Models -1

• We discussed three well-established models that generate


networks with commonly observed characteristics of real-
world networks:
• random graphs,
• the small-world model, ( augmented this with myopic search).
• preferential attachment
Graph Theory and its Applications
Summarizing Generative Models -2

• Random graphs assume that connections are completely


random. We discussed two variants of random graphs:
• G(n, p)
• G(n,m).
• Random graphs exhibit a Poisson degree distribution with
large n , underestimates clustering coefficient p, and gives a
realistic average path length
Graph Theory and its Applications
Summarizing Generative Models -3

• Small world model assumes that individual nodes have fixed no of local
connections in addition to random long ( global) connections.
• This model generates networks with high transitivity and short path
lengths, both commonly observed in real-world networks.
• Small-world models are created through a process where a parameter
controls how edges are randomly rewired from an initial regular ring
lattice.
• Empirically, when between 1% to 10% of edges are rewired (0.01 <= <=
0.1), the model resembles many real-world networks.
• Unfortunately, the small-world model generates a degree distribution
similar to the Poisson degree distribution observed in random graphs.
• So, it gives acceptable average clustering coefficient and average path
length but unrealistic degree distribution
Graph Theory and its Applications
Summarizing generative models -4

• The preferential attachment model assumes that friendship


formation likelihood depends on the number of friends target
individuals have.
• The model generates a scale-free network; that is, a network with
a power-law degree distribution.
• The preferential attachment model also exhibits realistic average
path lengths that are smaller than the average path lengths in
random graphs.
• The basic caveat of the model is that it generates a small clustering
coefficient, which contradicts high clustering coefficients
observed in real-world networks.
THANK YOU

S Upadhyaya
Department of Computer Science and Engineering
[email protected]
GRAPH THEORY AND ITS APPLICATIONS

Myopic or Decentralized Search

S Upadhyaya
Department of Computer Science
and Engineering

These slides are the modified versions of the slides prepared by Dr. Bhaskarjyoti Das for the course “Network
mining and Analysis” with additional inputs from Dr. Arti Arya
GRAPH THEORY AND ITS APPLICATIONS

Recap of Milgram’s experiment

S Upadhyaya
Department of Computer Science and Engineering
GRAPH THEORY AND APPLICATIONS
Recap : Milgram’s experiment

• Randomly chosen “starter” individuals to forward letter to


“target person” living in Boston suburb
• Cannot directly mail –
○ only forward to a person he/she knows on 1st person
basis and the process continues
• A third of letters reached the target with median of 6 steps
• Hence the “six degrees”
GRAPH THEORY AND APPLICATIONS
Small world effect that we see

• In many networks the typical network distances between


vertices are surprisingly small
• Small world effect

• Mathematically, the small world effect is a hypothesis


meaning that the mean distance is “small”
• Typically networks have been found to have mean distance less
than 20 – or in many cases less than 10 – even though the
networks themselves have millions of nodes

• Implications in Social Networks.


• rumor spread in a social networks
• response time is small in the Internet etc.
GRAPH THEORY AND APPLICATIONS
Small world effect is not surprising

• The small world effect is not surprising


• Mathematical models for networks suggest that the mean path
length l in a network increases slowly with the number n of vertices
in the network
• l ~ log(n)
• This length ℓ should not grow faster than logarithmically as the
number of nodes tends to infinity.
• That is, ℓ=O(logN) as N→∞.
• Similarly, the diameter of a network is relatively small as well
• Scales logarithmically as well with the number of vertices
GRAPH THEORY AND APPLICATIONS
Issues with Milgram’s set up

• A large fraction of his test subjects were stockbrokers


• So are likely to know how to reach the “goal”
stockbroker
• A large fraction of his test subjects were in boston
• As was the “goal” stockbroker

• A large fraction of letters never reached


GRAPH THEORY AND APPLICATIONS
Key Findings of Milgram’s Experiment

• Demonstrated two key facts



Small world - Short paths are there in abundance
• Decentralised search - People acting without any sort of global map are
effective at collectively finding these short paths
• There’s no reference to decentralized search directly in Milgram’s experiment
• But starters would have definitely sent letter to someone whom they thought
would know the target
• We may say that decentralized search is at play although not directly
• Though Milgram’s experiment is supposed to test the hypothesis that people are
connected by short paths on global social network , it is also an empirical study
of people’s ability to collectively solve a problem (example – searching for a
path to a far-off individual)
• By using only local information ( the alters of an ego ?)
• By communicating only with the neighbours in the social graph
GRAPH THEORY AND APPLICATIONS
Milgram’s experiment was more successful with high status nodes

• Success rate at finding targets in recreations of Milgram


experiments has often been lower
• Lack of participation
• Milgram style experiment is successful when the target
is of socially high status and low success when the
reverse is true
• Variation in success rate is based on the fact that social
networks are structured to make high status individuals
much easier to find
GRAPH THEORY AND APPLICATIONS
Core and Periphery structure in social networks

• Though homophily suggests that high High Status Nodes


status people should mainly know high
status folks and low status people should
mainly know low-status people – the
real world social networks do not
display such symmetry
• Instead there is a dense core of highly
interconnected high-status people with
low status people forming periphery
• Low status people do not form the core
and are more fragmented while
crowding around core of high status
people
Low Status Nodes
GRAPH THEORY AND APPLICATIONS
Core periphery structure in Milgram’s experiment

• Social networks are structured into core periphery where core consists
of densely connected (through social foci such as club, interest,
occupation, education etc.) high status people whereas periphery
consists of low status folks clustered around the core
• Shortest path connecting two low status folks tend to go into the core
and come out again as the cores are like exchanges in telephone
networks
• As we move towards high status target, the link structure tends to
become richer. Conversely, as we move to low status target, the link
structure tends to become impoverished.
• So low status “source” to low status “destination” does not show
equal success rate !
• This explains why Milgram experiment is more successful with high
status folks.
GRAPH THEORY AND APPLICATIONS
Why Milgram’s experiment result was a surprising discovery ?

• Mathematically, if each knows 100 distinct


people, each can reach 10,000 in 2 steps
and 100*100*100 = 1,000,000 people in 3
steps. This means reaching ten billion in 5
steps !
• However, social graphs are full of triangles
(many of my 100 friends know each other
and not necessarily folks in the rest of the
world ! )
• Triadic closure limits the number of people
one can reach by following “short paths”
• This is the reason, results of Milgram’s
experiment is surprising !
GRAPH THEORY AND ITS APPLICATIONS

Does Watts and Strogatz model explain the


Milgram’s experiment fully ?
https://ww2.amstat.org/mam/04/essays/smallworld.pdf

S Upadhyaya
Department of Computer Science and Engineering
GRAPH THEORY AND APPLICATIONS
Recap : Watts and Strogatz small world model

• They observed that there are many triads in the network and it limits the
number of nodes that a node can reach.
• Still there exists short path connecting every pair of nodes on the graph
• Crux of Watts and Strogatz model : introducing a tiny amount of randomness
in the form of long range weak ties is enough to make the world small !
• Watts and Strogatz model starts with a regular lattice and rewires the edges
with a probability beta
• Small world network’s
• β is somewhere in the middle (no power law, low average path, high clustering coeff)
• If β = 0, Regular network (no power law, high average path, high clustering coeff)
• If β =1 , Random network ( no power law, low average path, low clustering coeff)
GRAPH THEORY AND APPLICATIONS
A simple grid based model

• Idea : Can we make up a simple model that exhibits both the


features i.e. many closed triads but also many short paths in
Watts and Strogatz Model ?
• A simple grid based model
• 2 nodes are one grid step apart if they are adjacent and directly
connected
• Homophily is defined as r grid steps
• Weak ties - For some constant value k, each node forms links to k
other nodes on random basis ( rewire k links)
• It is a hybrid structure – consisting of small amount of randomness
sprinkled into an underlying structured pattern
GRAPH THEORY AND APPLICATIONS
Watts and Strogatz model – how many random connections ?

• Mathematically it was shown that it requires very small amount


of randomness to achieve the small world effect - instead of
every node having k weak ties, one in k nodes to have a single
weak tie will achieve the same quantitative effect.
Graph Theory and its Applications
Watts and Strogatz model – how many random connections ?

Start with a d-dimensional


lattice network and add a small
number of long-range links out
of each node, to destinations
chosen uniformly at random.

A network created by this superposition will have local clustering and short
paths, just like many of the networks found in the real world. (See Figures 1 and
2.)
Graph Theory and its Applications
WS Model in One Dimension

The 2nd figure shows the myopic path that would be constructed if we
chose a as the start node and i as the target node in the network
GRAPH THEORY AND APPLICATIONS
Theorizing Milgram’s experiment for Decentralized Search

• Milgram’s experiment – essentially people were able to


collectively find short paths to the designated target
• This was kind of social search
• Together they “tunnelled through” the network to reach the destination !
• Naïve method – everybody sending to all of his friends and so on. This is
flooding or breadth first search. This does not work.
• Actually the people participating in the experiment did not flood their
neighbours. In fact they chose based on their own understanding of the
target and the suitability of his/her neighbours !
GRAPH THEORY AND APPLICATIONS
Where does the Watts and Strogatz model fail ?

• Watts and Strogatz model is a good start


• A starting node s has to pass an information to target t
• S knows only about all its neighbours and not more
• Given the above setup, it takes a large number of steps to reach a target ( much larger than
what Milgram found ).
• As a mathematical model Watts and Strogatz is effective in
• capturing density of triangles
• existence of short paths
• Not the ability of people collectively finding the actual paths to the target
• Essentially the weak ties that make the world small are just “too random”
• They are completely unrelated to the similarity among nodes that produces the homophily
based links – so hard for actual people to follow
• If we just follow that “pure random” strategy of sprinkling irregularity on a regular lattice
structured graph, we will NOT get the results that Milgram got ! It will take far more than 6
hops !
GRAPH THEORY AND APPLICATIONS
Decentralized or myopic search

Problem:
1. Assume that each node only knows his set of local contacts, the
location of his long-range contact, and the location of the target
2. Crucially, he does not know the long-range contacts of the his
contacts.
Solution:
1. In decentralised or myopic search, the current message-holder
chooses the contact that is closest to the target and forwards the
message to it.
2. This works recursively till the target is reached

• It is also called myopic search (Myopia = short sightedness) or


decentralised search (as every node on the path has a role to lay
in the collective search of the shortest path)
GRAPH THEORY AND APPLICATIONS
Decentralized Vs Myopic search

In theory these two searches are slightly different


However, in this context both types apply.
Myopic Search can be seen as a Phase of Decentralized Search
Decentralized Search:
People try to reach the target through different foci
They do not have one common agenda (that’s why decentralized)
Some people connected to Brokers. Some connected to people from Boston
Some may connect to both types if possible.
Myopic Search:
Search is Myopic because everyone can see who their neighbor is and not his
connections. (short-sighted)
Myopic search doesn’t result in shortest path.
Myopic search is the first phase and Decentralized search is the entire
phenomenon
GRAPH THEORY AND APPLICATIONS
Mild Generalization of Watts and Strogatz Model

• A mild generalization of the Watts & Strogtaz model can model


Milgram’s experiment better
• Note that every node in the hop chooses the next node ( shortest
path ) based on some criteria i.e. his understanding of the target
and his neighbors.
• So, the “random” path chosen by each hop varies and that is not
truly random!!
• We adapt the W&S model by introducing one extra quantity that
controls the “scales” spanned by long distance weak ties.
• On the grid model, now each of the k random edges generated
decays with distance
GRAPH THEORY AND APPLICATIONS
Generalizing W&S model

• For v and w, d(v,w) denote the number of grid steps ( if you have to
walk) between them
• For generating a random edge out of v, we have this edge link from
v to w with the probability proportional to d(v,w)-q where q is
some exponent (p∝ d-q)
• We can have a different model for each value of exponent q
• q=0 is the original W&S model (links are chosen uniformly at random);
• For small q, random edges tend to span longer distance
• For large q, they are shorter
• q = very small, the long range links are too random for an effective
decentralised search;
• q=very large, the long range links are not random enough
• Is there an optimum q ? It is found that the best performance occurs
when q is slightly less than 2 ( very close to 2)
GRAPH THEORY AND APPLICATIONS
Organize real world into different scales of resolution

1. We can mentally organize distances into blocks


• Across the world
• Across the country
• Across the state
• Across the town
• Across the block
2. Similar to consider groups of nodes at increasingly larger
distances
3. Nodes at distances 0-2, 2-4, 4-6, 6-8 and so on
4. Effectively decentralized search funnels through these different
scales of resolution ( somewhat like a factor of 2 in each step)
GRAPH THEORY AND APPLICATIONS
Intuitive understanding of why number 2 is important
No of nodes
• This can be logically understood proportional
• We can divide the whole zone of Milgram experiment into to d2
zones defined by ranges i.e. 0-2,2-4 etc. Effective decentralized
search “funnels” through these different scales of resolution
• Since area of the plane grows like square of the radius, total no vd
d w
of nodes varies as d2
• Probability p of generating a random edge out of v to w within 2d
radius d is proportional to d(v,w)-q = d-q ∝ 1/d2
• Now, what is the probability that v forms a link to some Probability of
node inside this group? linking to each
○ p * total number of nodes = d2 * 1/d2 (apporx) node proportional
○ p is independent of d! to d-2

• So, when q=2, we can have a qualitative way of thinking !! This


allows people to find ways of reaching the target no matter
how near or far it is
GRAPH THEORY AND APPLICATIONS
Qualitative way of thinking about the network for q=2

• The network that arises when q=2 has following characteristics


• long range weak ties are being formed in a way that is spread
roughly uniformly over all different scales of resolution
• This allows people forwarding their messages to consistently find
ways of reducing the distance to the targets , no matter how near or
far they are from it !
GRAPH THEORY AND APPLICATIONS
Summarizing Myopic Search

• Goal is to theorize Milgram experiment, is to forward message from


start node to target
• Each intermediate node only knows the location of its own neighbours and
location of the target ( nothing more about the network)
• Forwarding strategy is a technique called myopic search
• when a node v is holding the message, it forward to the contact that is closest
to target t on ring.
• This strategy is a reasonable approximation of the strategies used by
people in Milgram’s experiment
• Often the myopic path does not yield the real shortest path ( due to
lack of knowledge about the network )
• But in expectation ( detailed math in Advanced Material : Analysis of
decentralized search in Textbook) , myopic search yields paths that are
surprisingly short
THANK YOU

S Upadhyaya
Department of Computer Science and Engineering
[email protected]
Graph Theory and its Applications

Dynamics : Herding and Diffusion

Dr. Arti Arya


Department of Computer Science
and Engineering
Graph Theory and its Applications

Types of dynamics in graph

Dr. Arti Arya


Department of Computer Science and Engineering
Graph Theory and its Applications
Acknowledgement

The course slides are prepared by Prof. BhaskarJyoti. But various


additional inputs are added by me from various reliable resources from
Foreign and Indian Universities as well as from sites.
Dynamics in graph

• Networks of different types :


• Technological network : Communication network, road network etc.
• Network of content : web , documents and media
• Human networks : connecting people and organizations
• So far we focused on static structure of the networks i.e. paths,
clusters, prominent nodes
• What we have NOT discussed so far is DYNAMICS in the social graph:
• Cascade, Contagion, Evolution !!
• Many things flow through networks ( traffic, information, disease ,
behaviour etc.) . We are now focusing on these !!
Dynamics in graph: Types of Information Diffusion

Types of Information Diffusion

Herd
Behavior Epidemics
Network is observable( Network is not observable
Explicit)

Cascade Diffusion of
Behavior Innovations
Network is observable but
only local behavior of nodes Network is not observable.
is known Connected to a new app but
you are aware about other
connections
https://www.google.com/search?q=Example+Story+for+Herding+behavior+in+networks&source=lnms&tbm=vid&sa=X&ved=2ahUKEwiGxoO5osT9AhV4-
3MBHQaaCBkQ_AUoA3oECAEQBQ&biw=1280&bih=601&dpr=1.5#fpstate=ive&vld=cid:f79b8428,vid:0IJCXXTMrv8
Network is explicit with full observability : herding

• Network is observable – this can happen only with explicit


network
• Example: you are sitting in a class with your class-mates
every day, we can say that NETWORK BETWEEN THE CLASS-
MATES IS OBSERVABLE and it is EXPLICIT.
• As Network is observable, behaviour of all nodes are visible
(information is available about every node) to every other
node.
• Dynamics that can happen here is “herding”
Network is explicit but only with local (observability) : cascade

• When the Network is observable but not all nodes. The node is
aware only of the “local “ part of the network !!
• Example (Network is explicit but only with local info) :
• You know everything about your community ( sub-group of 5th semester
students you hang-out with . There are other sub-groups with different likes
and dislikes but you hardly know enough about them
• Your group makes it a point to participate in group coding on weekends.
Another group makes it a point to spend the weekend in teaching in
orphanage
• Will your group start spending weekend in the orphanage or will the other
group start spending the weekend in group coding ?
• If you want to convert the other group, will you target all the members or
will you first target the leader of the group ( = who is connected to the rest
of the members) ?
• The conversion, if happening or happens, is called “Cascade” -
network is explicit/observable but only local information is
available.
Network is implicit with no information : diffusion of information

• When the explicit network is NOT available and visible, the


way you model it , need NOT factor in the network !!
• Example
• If we make a network based on the some new app that is getting
adopted by the students in Bangalore, it is an IMPLICIT NETWORK (
edge means common usage)
• Think of the new “Idli Mix” is getting launched in Bangalore . It is an
implicit network that is not visible and no information is available
about all the nodes !! But the company that launched the product
need to estimate how many to manufacture to meet the needs
• This kind of dynamics is DIFFUSION
Network is implicit with no information : Epidemics

• Epidemic & Pandemic (epidemic over multiple countries)


• Example ( COVID 19)
• If you visit a crowded place, you may get COVID 19 if you come in
contact with a carrier of that virus if “safe distance is not maintained”
• You can draw an edge wherever there is a distance lesser than the
safe distance
• This is an IMPLICIT NETWORK with no information available !
• If you are susceptible and the person carrying infection ( = infected)
are connected through an edge (because there is a distance lesser than
safe distance), you will get infected with COVID -19 with certain
probability
• This kind of dynamics is observed in “Epidemic” .
Types of dynamics or Types of Information Diffusions in networks
Herding

Dr. Arti Arya


Department of Computer Science and Engineering
Herding Behavior

• In network science,
herding refers to the
phenomenon where
individuals in a network
tend to conform to the
opinions or behaviors of
the majority, even if those
opinions or behaviors are
incorrect or irrational.

Janasamūhada manasthiti

ಜನಸಮೂಹದ ಮನಸ್ಥಿ ತಿ
Milgram’s experiment: Another Example

• Stanley Milgram asked one person to stand still on a busy street


corner in New York City and stare straight up at the sky.

• About 4% of all passersby stopped to look up.


• When 5 people stand on the sidewalk and look straight up at the
sky, 20% of all passer by stopped to look up.
• Finally, when a group of 18 people look up simultaneously, almost
50% of all passersby stopped to look up.
Intervention

• In general, herd’s behavior network is close to a complete graph


where nodes can observe most other nodes and they can observe
public information.

• Individuals make decisions by observing all other individuals’


decisions.

• Herding may be intervened by releasing private information which


was not accessible before.

• The little boy in “The Emperor’s New Clothes” story intervenes the
herd by shouting “he's got no clothes on”
The Emperor’s New Clothes: Another Example

https://owlcation.com/humanities/EmperorsNewClothes
NETWORK ANALYSIS AND MINING
Intervention

In "The Emperor's New Clothes" story, the majority of the people in the herd were
pretending that the emperor was wearing magnificent clothes, even though he was
actually naked. The little boy's intervention disrupted this herding behavior by speaking
out and expressing an opinion that was contrary to the majority.
From a network science perspective, the little boy's intervention can be described as a
"disruptive influence" on the herd. His action challenged the existing norms and beliefs
of the herd and introduced a new perspective that was not previously considered. This
disruption may have caused some members of the herd to re-evaluate their own
opinions and beliefs, leading to a potential shift in the overall behavior of the network.
Overall, the little boy's intervention in "The Emperor's New Clothes" story is a powerful
example of how a single individual can disrupt herding behavior in a network by
introducing a new perspective or idea. This disruption can lead to a shift in the overall
behavior of the network, and highlights the importance of diverse perspectives and
opinions in driving positive change.
Intervention
Herding in online auction: Another Example

• Individuals
• can not only observe the bidding behaviors of others
• but can also often view profiles of others to get a feel for
their reputation and expertise.
• In these online auctions, it is common to observe individuals
participating actively in auctions, where the item being sold
might otherwise be considered “not so great”. .
Cascading
Modelling diffusion through a network

• Individual choice depends on what other people do


• Homophily was a basic assumption ( did not look further inside)
• This helped use of information cascade, network effects and rich-
gets-richer dynamics in modeling the way innovations get
“Social adopted by population
Graph” behind Facebook’s valuation
• In this kind of analysis, two levels of granularity are possible

• View network as an amorphous population of individuals and look


at effects in aggregate
• Move closer to fine explicit structure of network as a graph and
look at how individual choice gets affected by neighbors in the
graph
What do we gain by this finer level of resolution ?

• The second view addresses a number of phenomena that


cannot be modeled well at the level of homogenous
populations
• Many of our interactions with rest of the world are at local
rather than global level
• Often we care more about decisions made by our immediate
neighbours in the network than the decision by the overall
population
• Often we adopt political views that are locally majority but
globally minority
• Often we adopt technology that is locally popular but globally a
failure
Cascade vs. Herding

• An information cascade is defined as a piece of information or decision being


cascaded among a set of individuals, where
• 1) individuals are connected by a network and
• 2) individuals are only observing decisions of their immediate neighbours
(friends).

• In cascading, local information is available to the users, but in herding the


global information about the population is available.

• A cascade develops when people abandon their own information in favor of


inferences based on earlier people’s actions.

• Individuals in a cascade are imitating the behavior of others, but it is not


mindless imitation. Rational inferences are drawn from limited
information.
Diffusion vs. Cascade

• When we inject a new idea or new behaviour, it travels through the


social network to different nodes with whom the “injected alter”
has strong links. This is diffusion.

• This trajectory of diffusion is cascade. When we refer “cascading


behavior”, we are essentially modeling diffusion through a
network.

• Definition : A cascade of adoptions of behavior A from existing


behavior B is a chain reaction of switches from B to A.
Studying dynamics – graph vs. game theory

• An underlying structure of interconnecting links


• Studied by graph theory

• An interdependence in the behavior of individuals who inhabit


the system, so that the outcome for any one depends on the
combined behaviors of all
• Studied via game theory
Rationale for Following the crowd

• There are many rationale for an individual to imitate the choice of others

2 Rationale behind
Following the crowd

Information Effects: Direct-Benefits:


choices made by others there are direct benefits
can provide information from copying the
about what they know decisions of others

• Information effects may entail making choice contrary to one’s own


information i.e. restaurant choice.
• Direct benefit effect depends on payoff
Calculate payoff in a network : direct benefit effect

bunk
attend

Here n=8
Simple model

• An individual level model of direct-benefit effects in networks


due to S. Morris
• The benefits of adopting a new behavior increase as more and
more of the social network neighbors adopt it
Basic idea of combining payoff

• Each node –
• plays the game with each neighbor
• Payoff = sum of payoffs of each link

• Consider node v –
⮚ Some neighbors adopt A
⮚ Some neighbors adopt B

• So the maximum payoff of node v:


• A node v should adopt A if at least a certain fraction of its neighbors
follow A.
Networked coordination game: Payoff of node v

1. Each node v plays the same game with each ▪ A is a better choice if
of its neighbors
2. Its payoff is the sum of the payoffs in the
games played on each edge ▪ After rearranging,
3. Hence v’s choice of strategy will be based on
the choices made by all of its neighbors ,
taken together
▪ We call RHS as
Threshold q for
preferring A

It is a myopic model of individual decision making (=immediate consideration only).


In a richer model, models will try to have more long range consideration !
The myopic model of individual decision making
Social reinforcement playing a role …cascading behaviour

• We originally decided to bunk


• But more and more people decided to attend ( with b and
a remaining the same ..)
• Reason : payoff (for bunking) reached bottom
• The ratio value changed
• Now we decided to attend classes
Modeling cascade

The largest value of the fraction ‘q’


that would still enable all the users
in the network to adopt the same
decision is called the cascading
capacity of the network.
Cascading behavior – when everybody switches

The coordination game is set up as follows:


a = 3, b = 2, so q = 2/5 i.e. nodes will switch from B to A if at least
a fraction q of their neighbors are using A
v and w are the early adopters
Cascading behavior – when everybody switches

A A

(a) (b) (c ) Step 1

Step 2
(d )
Cascading behavior – when everybody does not switch

Here, the game is set up for a =


3, b = 2, q (threshold) = 2/5.
Nodes 7,8 are the early
adopters
Cascading behavior – when everybody does not switch

(b)
Cascading behavior – when everybody does not switch

Step 1 : nodes 5, 10
switch to A as 2/3 > 2/5
Cascading behavior – when everybody does not switch

Step 2 : 4,9 switch


Cascading behavior – when everybody does not switch

Step 3 : 6 switch
At this no further
node will be
willing !
Three possibilities and defining complete cascade

• At the end, three things can happen


• All bunked or all attended . In the case all adopted behaviour A or all
adopted behaviour B
• A group bunked and another group attended
• Definition : For a set of initial adopters who start with a new
behaviour A while every other node starts with behaviour B .
Nodes then repeatedly evaluate decision to switch from B to A
using a threshold of q
• If the resulting cascade of adoptions of A eventually causes every node to
switch from B to A , we say that the set of initial adopters completed
cascade at threshold q
• Note that our discussion about co-existence of A and B along a
natural boundary in the network depends not only on the
network structure but also on the relative payoff of coordinating
on A versus B
Coming back to Class Bunk example- Cluster and Cascade

• If the class has strong communities (weak tie


between the groups and strong tie within the
group), then it will result in the 3rd possibility ( bunk
two groups bunk vs no-bunk) attend

(At the end, three things can happen


• 1. All bunked .(all adopted behaviour B )
• 2. All attended . (all adopted behaviour A)
• 3. A group bunked and another group attended

Here n=8
• The groups or communities are too strongly tied
within than with other communities
• So, clustering can stop cascade.
Cascading and Cluster and cluster density

• A cluster of density p is a set of nodes such that every node in the set has
at least a p fraction of its neighbors in the cluster itself

Similarly for other 2


clusters

{ a, b , c, d} is a cluster of density p=2/3.


Every node of the cluster has the following neighbors:
1. Nghb. of a= {b,c}
2. Nghb. of b= {c, d, a}
3. Nghb. of c= {b, a , d}
4. Nghb. of d= {b,c, e}
Neighbors of a, b, c are 100% in the cluster and neighbors of d are such that 2/3rd
of them are in the cluster so density=2/3
Cluster and cluster density

▪ By this definition, in any network, set of all nodes is always a cluster of density 1
(as all neighbors reside in the network).

▪ The union of any two cluster of density q is also a cluster of density at least q .

▪ Diffusion happens easily within the cluster but may not happen easily across . The
strategy should be to distribute the adopters across clusters
An example

Threshold (q) = 3/5

Hence both clusters will block cascade


Cascade and cluster : extending the previous example

Cluster {1, 2, 3} : few nodes have 2/3 and


rest have 1 as density i.e. at least 2/3.
Hence it will also block
Cascade and cluster : extending the previous example
Here, the game is set up for a = 3, b = 2, q (threshold) = 2/5
So cluster of density greater than (1-2/5) = 3/5 will block the spread at
threshold 2/5
Nodes 7,8 are the early adopters (b)

(a)
Note :
1. Nodes 4,9 aware of A but took Step 1 : nodes 5, 10 switch to
longer to adopt A A as 2/3 > 2/5
2. Aware but not adopted Step 2 : 4,9 switch
1. 1,2,3 is a cluster of density Step 3 : 6 switch
2/3 which is greater than 3/5 At this no further node will be
= (1-2/5) willing !
2. Node 11,14 -> 2/3, (c )
13,15,16,17 ->1,12->4/5 Step 3
; so density is 2/3 which is
again greater than 3/5
Diffusion of Innovations
Diffusion of innovation

• An innovation is “an idea, practice, or object


that is perceived as new by an individual or
other unit of adoption”

• The theory of diffusion of innovations aims to


answer why and how these innovations spread.
Diffusion of innovation : the process

• The individual becomes aware of the innovation, but


Awareness her information regarding the product is limited

• The individual shows interest in the product and


Interest seeks more information

• The individual tries the product in his mind and


Evaluation decides whether or not to adopt it

Trial • The individual performs a trial use of the product

• The individual decides to continue the trial and


Adoption adopts the product for full use
Diffusion of innovation ( Everette M Rogers)

Innovators : Willing to take risks. These are people who want to be the
first to try the innovation. (2.5%)

Early adopters : They are leaders who are already aware of the need to
change and so are very comfortable adopting new ideas (13.5%)

Early Majority : They are not leaders but they typically need to see
evidence that the innovation works before they are willing to adopt it(34%)

Late Majority : These people are skeptical of change and will only adopt
an innovation after it has been tried by the majority. (34%)

Laggards : Conservatives, very skeptical of change and are the hardest


group to bring on board. (16%)
Diffusion of innovation ( Everette M Rogers)

Adoption Life Cycle

https://www.youtube.com/watch?v=NCRNZe0tNDs
Adopter categories and S curve

Cumulative Adoption
Rate
Geoffrey Moore – Crossing the chasm

• Technology adoption life cycle is flawed


!
• There are actually big gaps where
fledgling startups can fall flat
“Social Graph” behind Facebook’s valuation
• Cause of this adoption gap :
Technology enthusiasts, Visionary (see
exponential benefits and want to
influence technology to shape it) ,
pragmatist (only when there is proven
benefit), conservative ( adopt only
when loss in not adopting), skeptics (
adopted only when forced)
Geoffrey Moore – Crossing the chasm
• As a software start-up, one BIG challenge is
crossing the chasm.

• The chasm refers to the technology


adoption lifecycle or the transition from
the early market into the mainstream
“Social Graph” behind Facebook’s valuation
market.
• Early adopters are willing to test new
technology in order to establish trends;
they are willing to try something new and
unproven.
• And, the Early and Late majority of users
who will embrace your product are far
more risk-averse. They need confirmation
that the goods will benefit them.
Adopter cycle, chasm and hype cycle

“Social Graph” behind Facebook’s valuation


Bass model of diffusion
Bass Diffusion Model - Introduction

⮚ The Bass diffusion model is one of the most thoroughly researched


models in market forecasting.

⮚ The model has proven to be versatile in representing the different


patterns of adoption of products — from “sleepers”, where the sales
pick up is gradual, to the “blockbusters”..

⮚ The Bass Model designed to answer the question:


How many customers will eventually adopt the new product and
when?
Bass Diffusion Model – Classic Use Case

⮚ Bass diffusion model is a classic way to predict sales for newly


launched product in the market.

⮚ After launching a new product in the market, sales prediction for it


has always been a difficult task due to lack of historical data.

⮚ It helps in making overall strategy for the product like determining


the time for markdown, promotion and introduction of an updated
version of the product in the market.
Diffusion: Bass Model
⮚Based on the purchases of a consumer durable over time, Bass (1969) distinguished between two types of buyers:

Two types of Buyers

Innovators Imitators

Innovators are not influenced in ⮚Imitators are influenced by the


the timing of their initial purchase number of previous buyers.
by the number of people who Imitators “learn” in some sense, from
have already bought the product, those who have already bought.
Diffusion: Bass Model

⮚ The innovation coefficient(p):

⮚ p : innovators in the population. (rate of spontaneous innovation )

⮚ p reflects the extent to which adopters are influenced by their own intrinsic
tendency to innovate and by factors beyond the population (including members
of other populations and influences from “mass media” that affects all the
populations).
⮚The imitation coefficient(q): (rate of imitation due to social influence)
⮚q : represents the extent to which the adopters emulate other members of
the same population.
Bass model – Frank M Bass, 1963

• Consider discrete time period t and let F(t) be the fraction of agents
in a society who have adopted a new product or behaviour at time t
• How to model F(t) i.e. a relation between F(t) and F(t-1)?
Bass model basics

• Bass model is given by the difference equation


Bass model basics

• Bass model is given by the difference equation


F(t) = F(t-1) + p ( 1- F(t-1)) + q(1- F(t-1)) F(t-1)
• (1- F(t-1)) is the fraction of people who have not yet adopted
• p(1-F(t-1)) = rate of innovation * fraction of people who have not yet adopted
• (1- F(t-1)) can imitate F(t-1) at the rate q

• Solving this when p > 0 and with an initial condition that F(0) = 0, leads
to an expression of F(t)

• Bass Model has undergone lot of improvements but still packs lot of
insight.
Assumptions

• Diffusion process is binary ( either consumer adopts or don’t


adopt)
• Maximum number of potential adopters or buyers is fixed.
• All potential adopters eventually purchase/adopt.
• Repeat purchases are not accounted for.
• The impact of WoM is independent of adoption time.
Another version of BASS Model: `Assumptions
Diffusion: Bass Model: Another Representation
⮚ The other representation of the Bass Model is described by

⮚ Solving this when p > 0 and with a condition that F(0) = 0, leads
to an expression of

⮚ As the parameters p and q are varied, the Bass model can fit
a wide variety of diffusion curves.

⮚ Note that the ratio of q to p is the critical parameter that


determines the overall shape of the curve.
Diffusion: Bass Model

http://faculty.washington.edu/sundar/NPM/
BASS-
Forecasting%20Model/Bass%20Model%2
0Technical%20Note.pdf
Why Bass Model gives S curve ?

• S-shaped adoption curve : Bcoz diffusion begins slowly, then


accelerates, and then eventually slows down and asymptotes.
• Bass model can exhibit the S-shape. Note that initially there no
imitation agents in the population to imitate.
• The first adopters are almost entirely those who adopt from their own
spontaneous innovation
• As the process progresses, there are more agents around to be
imitated and this leads to an increase in the rate of diffusion since now
agents adopt through imitation as well as innovation.
• There is a balance that occurs as the process progresses, since there are
more agents around worth imitating, but fewer around to do it .
• Eventually, the process has to slow down simply because there are no
longer agents left around who might innovate or imitate.
Bass model yields S curve
Bass model yields S curve
Bass model yields S curve
Different Values for p and q for a fixed market size
Limitations in Bass model

• Coefficient estimation of the model needs some past data of the product.
However, it might be too late for the business to take any decision by the
time the data is available
• This may apply for yearly data, but is rarely valid for monthly or quarterly
sales data which fluctuates due to causal factors like promotions and
advertising.
• The basic model assumes that market potential is fixed. This is not true
because elements of the marketing mix such as price, advertising,
distribution and product keep changing.
• A prime forecasting objective for marketers is to assess the potential
market of a product. Where sales data is not available, we have to rely on
other heuristics or estimates diluting its utility
• Does not allow for repeat or replacement purchase or cannibalization of
products
THANK YOU

Dr. Arti Arya


Department of Computer Science and Engineering
Graph Theory and its Applications

Epidemics model

S Upadhyaya
Department of Computer Science
and Engineering

These slides are the modified versions of the slides prepared by Dr. Bhaskarjyoti Das for the course “Network
mining and Analysis” with additional inputs from Dr. Arti Arya
Graph Theory and its Applications

Epidemics model

S Upadhyaya
Department of Computer Science and Engineering
Graph Theory and Its Applications
What is an epidemic ?

• An epidemic consists of
1. A pathogen or a disease
2. A population of hosts
3. A spreading mechanism
• Epidemics are typically across a country. Large multi
country epidemics are called pandemics whereas endemic
is location specific.
Graph Theory and Its Applications
Two approaches for epidemic modeling

Two Approaches for Epidemic Modeling

Fully Mixed Model( Mean


Contact Network Model
Field )
• Considers the underlying social network structure • Assumes each host has an equal chance of meeting other
of a population. hosts regardless of their social n/w connections
• It assumes that individuals interact with each other • Assumes implicit networks and unknown connections and
and can transmit the disease along their this makes models more suitable for global patterns and
connections. not in who infected whom!
• These models can capture the effects of network • Treats the population as a homogeneous group and do not
structure on disease spread, such as the presence account for the effects of network structure on disease
of highly connected individuals (known as "hubs") spread.
and the formation of clusters of infected • Used for modeling large populations where individual
individuals. connections are difficult to track or for simulating the
HIV/AIDS : edges represent sexual interactions. behavior of a disease in a hypothetical, idealized
population.
Graph Theory and Its Applications
Example : Ebola & HIV

• HIV • Ebola
• Less lethal than Ebola • First emerged in Zaire 1976
(now Democratic Republic
• Not fast spreading of Kongo)
• First appeared in the 70s • Very fast spread
• Initially confined in special • Very lethal: it can kill
somebody within a few
groups: homosexual men, days
drug users, prostitutes
• A small outbreak in 2000
• Eventually escaped to the • From 10/2000 – 01/2009,
entire population 173 people died in African
villages
Graph Theory and Its Applications
Example – Melissa computer worm, Hotmail viral marketing

• Melissa • Viral Marketing: Hotmail.com


• Started on March 1999 • Very fast spreading

• Infected MS Outlook users • Jul 1996: Hotmail.com started


service
• Very fast spreading
• Aug 1996: 20K subscribers
• The user
• Dec 1996: 100K
• Receives email with a word
document with a virus • Jan 1997: 1 million
• Once opened, the virus sends itself • Jul 1998: 12 million
to the first 50 users in the outlook
address book Bought by Microsoft for $400 million
• First detected on Friday, March 26 Marketing: At the end of each email
sent there was a message to
• By Monday infected >100K subscribe to Hotmail.com “Get
computers your free email at Hotmail"
Graph Theory and Its Applications
Recap
Graph Theory and Its Applications
Comparing

• Unlike herding

• Similar to diffusion of innovations models,


• Epidemic models assume an implicit network and unknown
connections between individuals.
Graph Theory and Its Applications
Epidemics model basics

• Model epidemic spread as a random process (probabilistic)


on the graph and study its properties
• Questions that we can answer:
• What is the projected growth of the infected population?
• Will the epidemic take over most of the network?
• How can we contain the epidemic spread?

• What is skipped ?
• These models are expressed in the form of differential equations.
Solving these equations are not discussed
Graph Theory and Its Applications
Different Models

Epidemic
Models

SIR SIS SIRS


SI Model
Model Model Model

If one is able to understand SI, SIR and SIS then SIRS model is straight forward in
terms of understanding
General definitions
⮚ N is the total population
▪ S(t) = number of susceptible at time t
▪ I(t) = number of infected at time t
▪ R(t) = number of recovered at time t
▪ s(t) = S(t)/N, the susceptible fraction of the population,
▪ i(t) = I(t)/N, the infected fraction of the population, and
▪ r(t) = R(t)/N, the recovered fraction of the population.
These are individuals who have either recovered from the
disease and hence have complete or partial immunity against
the infection or were killed by the infection.

For all time t,


Where N = S+I+R or N = S(t)+I(t)+R(t)
s(t) + i(t) + r(t) = 1
At t=0, S(0)=S I(0)=I R(0)=0
Graph Theory and its Applications

SI Model

S Upadhyaya
Department of Computer Science and Engineering
The SI Epidemic Model

⮚ The SI model is the simplest form of all disease


models. Individuals are born into the simulation
with no immunity (susceptible). One way flow
⮚ In this model, susceptible individual gets infected
and thereafter, they never get cured.
⮚ Once infected and with no treatment, individuals
stay infected and infectious throughout their life,
and remain in contact with the susceptible
population.
⮚ SI model matches the behavior of diseases like
cytomegalovirus (CMV) or herpes.

Susceptible Infectious
The SI Epidemic Model

⮚ Model assumptions:
⮚ population can live only in one of the compartments
⮚ Total population is fixed ( no entry , no exit )
⮚ Fixed rates ( interaction)

Susceptible Infectious
The SI Epidemic Model : Differential Equations

• Probability of a pair of people meeting at any time = β


If β= 1 , everybody meets everyone else and
if β=0, no meeting
• So, on an average infected individual will meet = βN people.
• Since susceptible fraction of population= S/N ,
• So, each infected individual will infect = βN * S/N i.e. βS.
• Since I are infected, βIS will be infected in the next time step.
• Number of susceptible people (S) will be reduced by this
factor as well.
The SI Epidemic Model : Differential Equations

• So, SI model can be written as the following ordinary


differential equation (ODE)

Since S+I = N , so
The SI Epidemic Model : Solution to Differential Equations

“Social Graph” behind Facebook’s valuation

After replacing # of infected


individuals by fraction of individuals
infected (for better generalization), we
get
GRAPH THEORY AND ITS APPLICATIONS

SIR Model

S Upadhyaya
Department of Computer Science and Engineering
SIR model

• There is a 3 stage life cycle for each node for disease


• Each node may be in the following states
• Susceptible: healthy but not immune
• Infected: has the virus and can actively propagate it for a given no of time
steps
• Removed: (Immune or Dead) had the virus but it is no longer active. Once the
node goes to this state, it is cured for life.

• Parameter p: the probability of an Infected node to infect a


Susceptible neighbor
SIR model

• Removed individuals are no longer susceptible nor infective for


whatever reason; for example, they have recovered from the disease
and are now immune, or they have been vaccinated, or they have been
isolated from the rest of the population, or perhaps they have died
from the disease.
SIR process
Example with tI=1
Example with tI=1
Example with tI=1
Example with tI=1
SIR epidemic example

Process of epidemic is
controlled by
(a) the contact
network structure
(b) probability of
contagion p
(c) length of infection
t1
The SIR Epidemic Model Specifics

⮚ Susceptible -> Infected -> Recovered : only one


way flow
⮚ Compartmental model – population can live
only in one of the compartments
⮚ Assumptions :
⮚ Total population is fixed ( no entry , no exit )

⮚ No reinfection

⮚ Recovery total

⮚ Fixed rates ( interaction, propensity to infect ,


recovery)
The SIR Epidemic Model

The SIR model


⮚ The second set of dependent variables represents the fraction of the
total population in each of the three categories.
So, if N is the total population, we have
▪ s(t) = S(t)/N, the susceptible fraction of the population,

▪ i(t) = I(t)/N, the infected fraction of the population, and

▪ r(t) = R(t)/N, the recovered fraction of the population.

Where N = S+I+R or N = S(t)+I(t)+R(t)

s(t) + i(t) + r(t) = 1

At t=0, S(0)=S0 I(0)=I0 R(0)=0


SIR Model

γ defines the
recovering probability
of an infected individual
“Social Graph” behind Facebook’s valuation
at a time stamp.
γI is the # of people
recovered in one time
step
By dividing one equation
with the other
SIR model , Solution of Equations ( no need to remember)

By dividing one equation with the other

“Social Graph” behind Facebook’s valuation

By manipulating between I , S and R

There is no closed form solution for this integration


and only numerical approximation is possible.
SIR Model
• This model is reasonably predictive for infectious diseases that are
transmitted from human to human, and where recovery confers
lasting resistance, such as measles, mumps, Influenza, Covid-19, TB,
HIV/AIDS and rubella etc..

• It has also been used outside of epidemiology, for example in


modeling the spread of song popularity, political influence, rumors,
gun ownership, and velocity response to traffic congestion.
• As implied by the variable function of t, the model is dynamic in that
the numbers in each compartment may fluctuate over time.
SIR Model

• The model can be used to predict the dynamics of an epidemic, such as


the peak number of infections, the duration of the outbreak, and the
effects of interventions.

• The basic SIR model is deterministic. This means that once the model
parameters (β and γ) are specified there is no randomness in the
model output.

• This is apparent by considering that all transitions between


compartments are specified by expected values and not probability
distributions.
When Does Infection Curve Flatten ?
When Does Infection Curve Flatten ?

Flattening is important as otherwise health


infrastructure cannot cope up !
• This happens when dI/dt = 0
• Recall β = how the infection travels( infection
probability or transmission rate)
• γ = Recovery rate
• At some point infection rate = the recovery rate
and beyond that point, recovery overtakes !!
Analyzing SIR Epidemic Model

⮚ As per the equations, dI/dt = βSI – γI = I (βS – γ ) and dS/dt= - βSI


⮚ If S > γ/β , I’>0 i.e. Epidemic grows Susceptible
⮚ If S < γ/β , I’ < 0 i.e. Epidemic slows down
⮚ Threshold = γ/β Infected

⮚ In this case β is the transmission coefficient and γ is the


recovery probability Recovered
Analyzing SIR Epidemic Model

⮚ Decrease β : Wash hands, Quarantine, school closure


⮚ Increase γ : Medicines etc. Not really very effective Susceptible
⮚ Decreases dS/dt : Vaccination can work if the epidemic has not
already started Infected
⮚ Finally, epidemic always runs out of susceptible and will
eventually die down Recovered
The Graphs : SIR Epidemic Model

The SIR model


• What happens if initial I = 0?

Answer: Nobody infected so


disease can not spread, nobody
gets sick
• What does it mean that red
line increases so rapidly?

Answer: This is a very


contagious disease.
The Graphs : SIR Epidemic Model

The SIR model


3. What does it mean that green line
also rises rapidly, but not as rapidly?

Answer: People recover quickly, but


slower than they become infected.
4. What does it mean that the green
line reaches nearly to 1,000?

Answer: Nearly everyone recovers,


disease not very deadly.
GRAPH THEORY AND ITS APPLICATIONS

SIS Model

S Upadhyaya
Department of Computer Science and Engineering
The SIS Epidemic Model
• So, far every node was getting infected at most once. But this may not
be the case always.
• Nodes can get reinfected multiple no of times.
The SIS model
⮚ The SIS Epidemic Model is a way of modeling diseases by classifying the
population based on their disease status.
⮚ 2 way flow !
⮚ S - The susceptible population who are not affected but are at risk
for infection.
⮚ I - Infected individuals who are capable of transmitting the disease

Susceptible Infectious
SIS model
SIS example

• Node v starts as infected, then recovers (susceptible) and gets infected again
• When no Infected nodes, virus dies out
• Question: will the virus die out?
SIS Model

• The SIS model is the same as the SI model with the


addition of infected nodes recovering and becoming
susceptible again
“Social Graph” behind Facebook’s valuation
SIS Model

“Social Graph” behind Facebook’s valuation


SIS Model

S I
• It will reach a steady
state where both
Susceptible and
“Social Graph” behind Facebook’s valuation Infected reach an
equilibrium

SIS model simulated with S0 = 99, I0 = 1, β = 0.01, and γ = 0.1


Life cycles of SIR and SIS

• SIR model :
• The epidemic or spread will eventually die out as the number of nodes are
limited in the network and eventually most nodes will be in “recovered”
state
• The network can be in either of two states after the epidemic has died out
• All nodes have recovered ( locked out from scope permanently)
• Some nodes have recovered and some are not infected. Those that are not infected,
did not get the infection because they did not have an adjacent infected node.
• SIS model :
• Unlike SIR model, it can keep running for ever as nodes move from infected
to susceptible state again
• However, there is a finite probability of epidemic stopping in this model ( it
depends on the network configuration)
Connections between SIR and SIS

1. Possible to represent some of the basic variants of SIS as special


cases of SIR by thinking of SIS as a sequence of SIR
2. Key insight is : we think about a node v being a different individual
at each time step
3. For TI =1, for a SIS model, at t=0,1,2,3,.. We create a separate copy of
each node and call this a time-expanded contact network
4. Same SIS Disease dynamics that was circulating through the original
contact network can now flow forward in time through time-
expanded contact network
SIS modeled as an SIS epidemic on the time-expanded network
SIR vs. SIS

• SIR model includes a recovered or


immune category, • SIS model does not have R category
• Individuals who recover from the • SIS model assumes that individuals
infection are assumed to be who recover from the infection
immune to the disease and are become susceptible again, and can
transferred to the recovered be re-infected with the same
category. disease. Therefore, the number of
susceptible individuals remains
• # of susceptible individuals constant over time.
decreases over time, as more
people become infected and then • The SIS model, however, does not
recover and move to the recovered have this natural end point, as
category. susceptible individuals can become
infected again and continue to
• SIR model allows for a natural end spread the disease.
to the epidemic, as the number of
susceptible individuals decreases to • can run for an extremely long time
a point where the disease can no
longer spread effectively.
THANK YOU

S Upadhyaya
Department of Computer Science and Engineering

You might also like