1
2pause <- function() {}
3
4### The Zachary Karate club network
5
6karate <- make_graph("Zachary")
7summary(karate)
8
9pause()
10
11### Create a layout that is used from now on
12
13karate$layout <- layout_nicely(karate)
14plot(karate)
15
16pause()
17
18### Run cohesive blocking on it
19
20cbKarate <- cohesive_blocks(karate)
21cbKarate
22
23pause()
24
25### Plot the results and all the groups
26
27plot(cbKarate, karate)
28
29pause()
30
31### This is a bit messy, plot them step-by-step
32### See the hierarchy tree first
33
34hierarchy(cbKarate)
35plot_hierarchy(cbKarate)
36
37## Plot the first level, blocks 1 & 2
38
39plot(cbKarate, karate, mark.groups=blocks(cbKarate)[1:2+1],
40     col="cyan")
41
42pause()
43
44### The second group is simple, plot its more cohesive subgroup
45
46plot(cbKarate, karate, mark.groups=blocks(cbKarate)[c(2,5)+1], col="cyan")
47
48pause()
49
50### The first group has more subgroups, plot them
51
52sub1 <- blocks(cbKarate)[parent(cbKarate)==1]
53sub1
54plot(cbKarate, karate, mark.groups=sub1)
55
56pause()
57
58