Girvan-Newman Algorithm
Girvan-Newman Algorithm
Ø edge.betweenness(mynetwork)
Ø [1] 2.0 3.0 3.5 2.5 3.5 5.5 5.0
Example1: Delete edge (4,5)
Øedge.betweenness(mynetwork)
Ø[1] 4 1 9 4 8 5
Example1: Delete edge (2,3)
Øedge.betweenness(mynetwork)
Ø[1] 1 1 1 2 2
Example1: Delete edge (3,4) and (4,6)
Øedge.betweenness(mynetwork)
Ø[1] 1 1 1
Example1: Delete edge (2,1), (5,1) and (5,2)
Øedge.betweenness(mynetwork)
Ønumeric(0)
Example1: An example via package igraph: the
edge.betweenness.community() function
Example1: An example via package igraph: the
edge.betweenness.community() function
Øedge.betweenness.community(mynetwork)
ØIGRAPH clustering edge betweenness,
Øgroups: 2, mod: 0.2 + groups:
Ø$`1`
Ø[1] "1" "2" "5"
Ø$`2`
Ø[1] "3" "4" "6"
Example1: Plot dendrogram for hierarchical
methods via igraph function plot_dendrogram()
12
1
33
49
Need to re-compute
betweenness at
every step
7 8
4 6 12 13
5 14
1 10
7 8
4 6 12 13
5 14
1 10
7 8
4 6 12 13
5 14
1 10
7 8
4 6 12 13
5 14
1 10
2 3 9 11
7 8
4 6 12 13
2 3 9 11
7 8
4 6 12 13
2 3 9 11
7 8
4 6 12 13
2 3 9 11
7 8
4 6 12 13
5 14
Edge betweenness = 49
1 10
2 3 9 11
7 8
4 6 12 13
5 14
1 10
Calculate betweenness
for edge 3-7
2 3 9 11
7 8
4 6 12 13
5 14
1 10
3 units flow from
1-3 to each 4-14 node,
so total =
2 3 3 x 11 = 33 9 11
7 8
4 6 12 13
5 14
Betweenness = 33
1 for each 10
symmetric edge
2 3 9 11
33 33
7 8
33 33
4 6 12 13
5 14
1 Calculate betweenness 10
for edge 1-3
2 3 9 11
7 8
4 6 12 13
5 14
1 Carries all flow to node 10
1 except from node 2,
so betweenness = 12
2 3 9 11
7 8
4 6 12 13
5 14
1 betweenness = 12 10
12 for each 12
symmetric edge
2 12
3 9 12
11
7 8
12 12
4 6 12 13
12 12
5 14
1 Calculate betweenness 10
for edge 1-2
2 3 9 11
7 8
4 6 12 13
5 14
1 Only carries flow 10
from 1 to 2, so
betweenness = 1
2 3 9 11
7 8
4 6 12 13
5 14
1 betweenness = 1 10
1 for each symmetric edge 1
2 3 9 11
7 8
4 6 12 13
1 1
5 14
1 Edge with highest 10
1 12 betweenness 12 1
2 12
3 9 12
11
33 33
49
7 8
33 33
12 12
4 6 12 13
1 12 12 1
5 14
Communities in physics collaborations
J. Leskovec, A. Rajaraman, J. Ullman: Mining of Massive Datasets, http://www.mmds.org 45
Zachary’s Karate club:
Hierarchical decomposition
B C I
A D G K
E H J
Method 2: Computing Edge
Betweenness Efficiently
For each node N in the graph
1. Perform breadth-first search of graph starting at
node N
2. Determine the number of shortest paths from N
to every other node
3. Based on these numbers, determine the
amount of flow from N to all other nodes that
use each edge
Divide sum of flow of all edges by 2
Breadth-first search
from node A A
B C D E
F G H
I J
K
Method 2: Computing Edge
Betweenness Efficiently
For each node N in the graph
1. Perform breadth-first search of graph starting at
node N
2. Determine the number of shortest paths from N
to every other node
3. Based on these numbers, determine the
amount of flow from N to all other nodes that
use each edge
Divide sum of flow of all edges by 2
A
1 B C 1 D 1 E 1
add add
F 2 G 1 H 2
add add
I 3 J 3
add
K 6
Method 2: Computing Edge
Betweenness Efficiently
For each node N in the graph
1. Perform breadth-first search of graph starting at
node N
2. Determine the number of shortest paths from N
to every other node
3. Based on these numbers, determine the
amount of flow from N to all other nodes that
use each edge
Divide sum of flow of all edges by 2
A
1 B C 1 D 1 E 1
F 2 G 1 H 2
I 3 J 3
1 B C 1 D 1 E 1
F 2 G 1 H 2
I 3 J 3
1 B C 1 D 1 E 1
F 2 G 1 H 2
1 ½
I keeps 1 unit &
passes along ½ I 3 J 3
unit; gets 2 times ½ ½
as much from F
K 6
A
1 B C 1 D 1 E 1
F 2 G 1 H 2
1 ½ ½ 1
J keeps 1 unit &
I 3 J 3 passes along ½
½ ½
unit; gets 2 times
as much from H
K 6
A
1 B C 1 D 1 E 1
1 1
F 2 G 1 H 2
1 ½ ½ 1
F keeps 1 unit &
passes along 1 I 3 J 3
unit; equal, so ½ ½
divide evenly
K 6
A
1 B C 1 D 1 E 1
1 1 2
F 2 G 1 H 2
1 ½ ½ 1
G keeps 1 unit &
passes along 1 I 3 J 3
unit ½ ½
K 6
A
1 B C 1 D 1 E 1
1 1 2 1 1
F 2 G 1 H 2
1 ½ ½ 1
H keeps 1 unit &
I 3 J 3 passes along 1
unit; equal, so
½ ½
divide evenly
K 6
B keeps 1 & A
passes 1
2
1 B C 1 D 1 E 1
1 1 2 1 1
F 2 G 1 H 2
1 ½ ½ 1
I 3 J 3
½ ½
K 6
C keeps 1 & A
passes 1
2 2
1 B C 1 D 1 E 1
1 1 2 1 1
F 2 G 1 H 2
1 ½ ½ 1
I 3 J 3
½ ½
K 6
D keeps 1 &
A
passes along 3
2 2 4
1 B C 1 D 1 E 1
1 1 2 1 1
F 2 G 1 H 2
1 ½ ½ 1
I 3 J 3
½ ½
K 6
A E keeps 1 &
passes along 1
2 2 4 2
1 B C 1 D 1 E 1
1 1 2 1 1
F 2 G 1 H 2
1 ½ ½ 1
I 3 J 3
½ ½
K 6
No flow yet…
A
2 2 4 2
1 B C 1 D 1 E 1
1 1 2 1 1
F 2 G 1 H 2
1 ½ ½ 1
I 3 J 3
½ ½
K 6
Computing Edge
Betweenness Efficiently
For each node N in the graph Repeat for B, C, etc.
1. Perform breadth-first search of graph starting at
node N
2. Determine the number of shortest paths from N
to every other node
3. Based on these numbers, determine the amount
of flow from N to all other nodes that use each
edge
Divide sum of flow of all edges by 2
Since sum includes flow from A B and B A, etc.
Example
b d
a g
Compute
c e #geodesics from
every node to g.
f
b d d=0
w=1
a
g
c e
f
Breadth-first search – means for doing many things.
Example
d=2 d=1
w=2 w=1
b d d=0
w=1
a
g
c e d=1
d=2 w=1
w=2 d=2
f
w=2