Beruflich Dokumente
Kultur Dokumente
CS224W
Network models
¤ https://ccl.northwestern.edu/netlogo/
¤ Models specific to this class:
http://web.stanford.edu/class/cs224w/
NetLogo/
Erdös and Rényi
Erdös-Renyi: simplest network model
¤ Assumptions
¤ nodes connect at random
¤ network is undirected
after spring
layout
Degree distribution
http://web.stanford.edu/class/cs224w/NetLogo/ErdosRenyiDegDist.nlogo
http://web.stanford.edu/class/cs224w/NetLogo/ErdosRenyiDegDist.nlogo
Degree distribution
" N −1 % k N−1−k
B(N −1;k; p) = $ ' p (1− p)
# k &
Quiz Q:
A B
C
G
F
E
Binomial coefficient: choosing 4 out of 7
G E C D B F A
binomial coefficient explained
G E C D B F A
7! = 7 * 6 * 5 * 4 * 3 * 2 * 1
binomial coefficient
Suppose the order of the nodes I don’t connect to (white) doesn’t
matter.
All possible arrangements (3!) of white nodes look the same to me.
A B F D E C G
A B G D E C F
A B E D F C G
A B D C
A B G D F C E
A B E D G C F
A B F D G C E
E F G
The same goes for the blue nodes, if we can’t tell them apart, we
lose a factor of 4!
binomial coefficient explained
n-1!
= -----------------
k! (n-1-k)!
Note that the binomial coefficient is symmetric – there are the same
number of ways of choosing k or n-1-k things out of n-1
Quiz Q:
P(white)*P(white)*P(blue)*P(blue)*P(blue)*P(white)*P(blue)
= p4*(1-p)3
Binomial distribution
¤ If order doesn’t matter, need to multiply probability
of any given arrangement by number of such
arrangements:
! 7 $ 4 3
B(7; 4; p) = # & p (1− p)
" 4 %
+
….
if p = 0.5
p = 0.1
What is the mean?
¤ Average degree <k>= z = (n-1)*p
¤ in general µ = E(X) = Σx p(x) probabilities that
sum to 1
0.25
0.20
0.15
0.10
0.05
µ = 3.5
Quiz Q:
sum to 1
0.20
(1.5)2 *
0.15
(-1.5)2 *
0.10
(-2.5)2 *
(2.5)2 *
0.05
(-3.5)2 * (-3.5)2 *
+ + + + + + +
0.00
Approximations
⎛ n − 1⎞ k
pk = ⎜⎜ ⎟⎟ p (1 − p) n−1−k Binomial
⎝ k ⎠
limit p small
k −z
z e
pk = Poisson
k!
(k−z)2 limit large n
1 −
2σ 2
pk = e Normal
σ 2π
Poisson distribution
Poisson distribution
What insights does this yield? No hubs
http://web.stanford.edu/class/cs224w/NetLogo/LatticePercolation.nlogo
Quiz Q:
average degree
n −1 − x⋅c −x −c
⎛ c ⎞ ⎛ 1 ⎞ ⎡ ⎛ 1 ⎞ ⎤
lim
n →∞
⎜
⎝
1 −
n − 1
⎟
⎠
= ⎜1 − ⎟
⎝ x ⎠
= ⎢lim ⎜1 − ⎟ ⎥
⎢⎣ x →∞ ⎝ x ⎠ ⎥⎦
= e −c
1 c
=
Use substitution x n − 1 e (by definition)
38
No Isolated Nodes
¤ How big do we have to make p before we
are likely to have no isolated nodes?
¤ We know: P[v has degree 0] = e-c
¤ Event we are asking about is:
¤ I = some node is isolated
¤ I = ∪ I v where Iv is the event that v is isolated
v∈N
Union bound
¤ We have: Ai
⎛ ⎞
P(I ) = P⎜⎜ ∪ I v ⎟⎟ ≤ ∑ P(I v ) = ne −c ∪A i ≤ ∑ Ai
⎝ v∈N ⎠ v∈N i i
39
No Isolated Nodes
¤ So if:
¤ p = ln n then: P(I) = 1
¤ p = 2 ln n then: P(I) = 1/n → 0 as n→∞
Jure Leskovec, Stanford CS224W: Social and Information Network Analysis, http://cs224w.stanford.edu 40
“Evolution” of a Random Graph
http://web.stanford.edu/class/cs224w/NetLogo/ErdosRenyiTwoComponents.nlogo
Quiz Q:
zl
Average shortest path
friends at distance l
Nl=zl
scaling:
average shortest path lav
log N
lav ~
log z
What this means in practice
¤ Erdös-Renyi networks can grow to be very large
but nodes will be just a few hops apart
20
average shortest path
15
10
5
0
num nodes
Logarithmic axes
¤ powers of a number will be uniformly spaced
1 2 3 10 20 30 100 200
num nodes
Quiz Q: