-
Notifications
You must be signed in to change notification settings - Fork 0
/
Random Graph Dataset Testing.R
81 lines (71 loc) · 1.64 KB
/
Random Graph Dataset Testing.R
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
library(igraph)
net <- erdos.renyi.game(150, 1000, type = "gnm")
plot(net, vertex.color=pal2, main="Random Graph")
#clustering coeff
transitivity(net)
#Girvan Newman
ceb <- cluster_edge_betweenness(net)
#Community plot
plot(ceb, net, main="Girvan-Newman Algorithm")
#modularity
modularity(ceb)
#no
length(ceb)
#Label propagation
clp <- cluster_label_prop(net)
#Community plot
plot(clp, net, main="Label Propagation Algorithm")
#modularity
modularity(clp)
#no
length(clp)
#Fast greedy optimization
cfg <- cluster_fast_greedy(as.undirected(net))
#Community plot
plot(cfg, as.undirected(net), main="Fast Greedy Algorithm")
#modularity
modularity(cfg)
#no
length(cfg)
#Spinglass algorithm
sg <- cluster_spinglass(net, spins = 10, start.temp = 1, stop.temp = 0.01,
cool.fact = 0.99, update.rule = "random",
gamma = 1)
#Community plot
plot(sg, net, main="Spin-Glass Algorithm")
#modularity
modularity(sg)
#no
length(sg)
#Walktrap
wtc <- cluster_walktrap(net)
#Community plot
plot(wtc, net, main="WalkTrap Algorithm")
#modularity
modularity(wtc)
#no
length(wtc)
#Multilevel
lvn <- cluster_louvain(net)
#Community plot
plot(lvn, net, main="Louvain Algorithm")
#modularity
modularity(lvn)
#no
length(lvn)
#infomap
ifm <- cluster_infomap(net, nb.trials = 10, modularity = TRUE)
#Community plot
plot(ifm, net, main="Infomap Algorithm")
#modularity
modularity(ifm)
#no
length(ifm)
#Leading eigenvector
lev <- cluster_leading_eigen(net)
#Community plot
plot(lev, net, main="Leading Eigenvector Algorithm")
#modularity
modularity(lev)
#no
length(lev)