GTA Unit4
GTA Unit4
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?
• In practice,
• find community partitions that are maximally decoupled.
Graph Theory and Its Applications
Types of Communities
Communities
Explicit/Emic/ Implicit/Etic/
EXPLICIT
• Facebook
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
S Upadhyaya
Department of Computer Science and Engineering
Graph Theory and Its Applications
Clique Percolation Method
• Input
• A parameter k (clique size) , and a network
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
Taking k=-3
Step 1:
Find Cliques of size 3.
clique of size 3
Graph Theory and its Applications
Finding overlapping Communities by CPM
Clique of size 4
Graph Theory and its Applications
Finding overlapping Communities by CPM
Clique of size 5
Graph Theory and its Applications
Finding overlapping Communities by CPM
k=3
Graph Theory and its Applications
Finding overlapping Communities by CPM
k=3
Clique 1:
Graph Theory and its Applications
Finding overlapping Communities by CPM
Clique 2
k=3
Graph Theory and its Applications
Finding overlapping Communities by CPM
Clique 3
k=3
Graph Theory and its Applications
Finding overlapping Communities by CPM
Clique 2
k=3
Clique 1
Clique 2 Clique 3
k=3
Clique 2
k=3
Clique 1
Graph Theory and its Applications
Finding overlapping Communities by CPM
Community 1
k=3
Graph Theory and its Applications
Finding overlapping Communities by CPM
Community 1 Clique 3
k=3
Graph Theory and its Applications
Finding overlapping Communities by CPM
Community 1
Community 2
k=3
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
1 4
5 9
2 3
6 7
Graph Theory and its Applications
Finding overlapping Communities by CPM
Clique 1: 5-clique
A 5-clique contains five 4-
cliques
Graph Theory and its Applications
Finding overlapping Communities by CPM
Clique 2: 4-clique
Graph Theory and its Applications
Finding overlapping Communities by CPM
Clique 5: 3-clique
Graph Theory and its Applications
Finding overlapping Communities by CPM
Algorithm
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
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
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
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
Community-2
Community-1
Graph Theory and its Applications
Finding overlapping Communities by CPM
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
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
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
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
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
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
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
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
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
S Upadhyaya
Department of Computer Science and Engineering
[email protected]
Graph Theory and Its Applications
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
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.
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)
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
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
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
2
Graph Theory, Applications and Combinatorics
Social Network Analysis
2
Graph Theory, Applications and Combinatorics
Social Network Analysis
2
Graph Theory, Applications and Combinatorics
Social Network Analysis
2
Graph Theory, Applications and Combinatorics
Social Network Analysis
2
Graph Theory, Applications and Combinatorics
Social Network Analysis
2
Graph Theory, Applications and Combinatorics
Social Network Analysis
2
Graph Theory, Applications and Combinatorics
Social Network Analysis
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
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
• Real-world communities are far from random; therefore, the more distant they
are from randomly generated communities, the more structure they exhibit.
• Modularity is the fraction of edges that falls within the given groups minus the
expected fraction if edges were distributed at random
• 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
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
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
Total number of
Graph Theory And its Applications
Louvain Algorithm Example from Paper
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
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
• 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.
Sujatha R Upadhyaya
Department of Computer Science and Engineering
GRAPH THEORY AND ITS APPLICATIONS
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
S Upadhyaya
Department of Computer Science and Engineering
GRAPH THEORY AND APPLICATIONS
Why are network models necessary ?
• Generative Models
• Random graph model (Erdos & Renyi, 1959)
• “Small world” model (Watts & Strogatz, 1998)
• Preferential attachment model (Barabasi & Albert, 1999)
GRAPH THEORY AND APPLICATIONS
S Upadhyaya
Department of Computer Science and Engineering
GRAPH THEORY AND APPLICATIONS
Kevin Bacon game
https://oracleofbacon.org/how.php
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
http://www.oakland.edu/enp/
Properties to be modeled :
S Upadhyaya
Department of Computer Science and Engineering
GRAPH THEORY AND APPLICATIONS
Power Law Distribution
• 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
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
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 ?
S Upadhyaya
Department of Computer Science and Engineering
GRAPH THEORY AND APPLICATIONS
Scale free ?
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
Properties to be modeled :
S Upadhyaya
Department of Computer Science and Engineering
GRAPH THEORY AND APPLICATIONS
Large Local Clustering Coefficient
Giant Component…
S Upadhyaya
Department of Computer Science and Engineering
GRAPH THEORY AND APPLICATIONS
Giant Components
S Upadhyaya
Department of Computer Science and Engineering
[email protected]
Graph Theory and its Applications
S Upadhyaya
Department of Computer Science
and Engineering
Graph Theory and its Applications
S Upadhyaya
Department of Computer Science and Engineering
Graph Theory and its Applications
Basic assumption
• 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
S Upadhyaya
Department of Computer Science and Engineering
Graph Theory and its Applications
Properties of Random Graphs
• c=(n-1)p or equivalently,
Graph Theory and its Applications
Expected number of edges in a G(n,p) graph
• 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
• 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
• 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
• 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
• 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
S Upadhyaya
Department of Computer Science and Engineering
Graph Theory and its Applications
Giant component formation : an example with increasing p for 10 nodes
• 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)
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
S Upadhyaya
Department of Computer Science and Engineering
[email protected]
GRAPH THEORY AND APPLICATIONS
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
S Upadhyaya
Department of Computer Science and Engineering
GRAPH THEORY AND APPLICATIONS
Small World Model
S Upadhyaya
Department of Computer Science and Engineering
[email protected]
Graph Theory and its Applications
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
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
• 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
S Upadhyaya
Department of Computer Science and Engineering
Graph Theory and its Applications
Nobody is perfect (;-
• 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
S Upadhyaya
Department of Computer Science and Engineering
[email protected]
GRAPH THEORY AND ITS APPLICATIONS
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
S Upadhyaya
Department of Computer Science and Engineering
GRAPH THEORY AND APPLICATIONS
Recap : 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 ?
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
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
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
• 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
S Upadhyaya
Department of Computer Science and Engineering
[email protected]
Graph Theory and its Applications
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
• 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
• 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
• 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
• There are many rationale for an individual to imitate the choice of others
2 Rationale behind
Following the crowd
bunk
attend
Here n=8
Simple model
• 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
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
A A
Step 2
(d )
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 3 : 6 switch
At this no further
node will be
willing !
Three possibilities and defining complete cascade
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
▪ 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
(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
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%)
https://www.youtube.com/watch?v=NCRNZe0tNDs
Adopter categories and S curve
Cumulative Adoption
Rate
Geoffrey Moore – Crossing the chasm
Innovators Imitators
⮚ 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
• 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
⮚ 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.
http://faculty.washington.edu/sundar/NPM/
BASS-
Forecasting%20Model/Bass%20Model%2
0Technical%20Note.pdf
Why Bass Model gives S curve ?
• 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
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
• 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
• Unlike herding
• 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
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.
SI Model
S Upadhyaya
Department of Computer Science and Engineering
The SI Epidemic Model
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
Since S+I = N , so
The SI Epidemic Model : Solution to Differential Equations
SIR Model
S Upadhyaya
Department of Computer Science and Engineering
SIR model
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
⮚ No reinfection
⮚ Recovery total
γ 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)
• The basic SIR model is deterministic. This means that once the model
parameters (β and γ) are specified there is no randomness in the
model output.
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
S I
• It will reach a steady
state where both
Susceptible and
“Social Graph” behind Facebook’s valuation Infected reach an
equilibrium
• 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
S Upadhyaya
Department of Computer Science and Engineering