If you want hire me as a freelancer please use the following links.
#Set working directory
setwd("G:\\Upwork\\Celeste")
#read graph from csv files
cbi98 = read.csv("cbi_only_edges_1998.csv",header = TRUE)
cbi99 = read.csv("cbi_only_edges_1999.csv",header = TRUE)
cbi00 = read.csv("cbi_only_edges_2000.csv",header = TRUE)
co98 = read.csv("co-occurrence_edges_1998.csv",header = TRUE)
co99 = read.csv("co-occurrence_edges_1999.csv",header = TRUE)
co00 = read.csv("co-occurrence_edges_2000.csv",header = TRUE)
#Merge graphs
Year98 = rbind(cbi98,co98[c(1,2,4)])
Year99 = rbind(cbi99,co99[c(1,2,4)])
Year00 = rbind(cbi00,co00[c(1,2,4)])
g98 = graph.data.frame(Year98,directed = FALSE)
g98 = simplify(g98,remove.multiple = TRUE,remove.loops = TRUE)
g99 = graph.data.frame(Year99,directed = FALSE)
g99 = simplify(g99,remove.multiple = TRUE,remove.loops = TRUE)
g00 = graph.data.frame(Year00,directed = FALSE)
g00 = simplify(g00,remove.multiple = TRUE,remove.loops = TRUE)#Top 10 Nodes, using Degree Centrality
sort(degree(g98),decreasing = TRUE)[1:10]## 609 771 461 1455 61 337 199 185 857 939
## 33 24 22 21 20 20 19 18 16 15
#Top 10 Nodes, using Betweenness Centrality
sort(betweenness(g98),decreasing = TRUE)[1:10]## 609 1455 771 337 857 185 61 680
## 2106.9828 1012.8326 972.9360 940.6570 897.4367 866.2037 864.3019 851.5789
## 461 199
## 846.4334 729.1046
#Top 10 Nodes, using Closeness Centrality
sort(closeness(g98),decreasing = TRUE)[1:10]## Warning in closeness(g98): At centrality.c:2784 :closeness centrality is not
## well-defined for disconnected graphs
## 609 771 337 185 1455 461
## 0.0001544640 0.0001541545 0.0001539172 0.0001536807 0.0001536807 0.0001536334
## 61 199 430 680
## 0.0001536098 0.0001533742 0.0001532802 0.0001532802
#Density of the Network
graph.density(g98)## [1] 0.02774378
#Degree Distribution of the network
degree.distribution(g98)## [1] 0.000000000 0.377906977 0.116279070 0.058139535 0.052325581 0.075581395
## [7] 0.087209302 0.052325581 0.034883721 0.017441860 0.017441860 0.005813953
## [13] 0.017441860 0.017441860 0.011627907 0.005813953 0.005813953 0.000000000
## [19] 0.005813953 0.005813953 0.011627907 0.005813953 0.005813953 0.000000000
## [25] 0.005813953 0.000000000 0.000000000 0.000000000 0.000000000 0.000000000
## [31] 0.000000000 0.000000000 0.000000000 0.005813953
#Assortativity of the network
assortativity.degree(g98)## [1] 0.01170191
#Diameter of the network
diameter(g98)## [1] 8
Coloring with communities.
Coloring with joing new Nodes, Where, yellow color represents the new nodes in the graph, while, blue color shows the old nodes. It means, old nodes are still some importance the network.
#Top 10 Nodes, using Degree Centrality
sort(degree(g99),decreasing = TRUE)[1:10]## 185 808 461 609 821 430 198 170 680 446
## 29 26 21 20 20 19 16 14 14 13
#Top 10 Nodes, using Betweenness Centrality
sort(betweenness(g99),decreasing = TRUE)[1:10]## 185 808 766 198 1319 481 461 609
## 1673.6295 1556.2568 1020.4479 912.4383 739.6970 738.0976 688.7137 663.8551
## 430 337
## 663.2190 647.0095
#Top 10 Nodes, using Closeness Centrality
sort(closeness(g99),decreasing = TRUE)[1:10]## Warning in closeness(g99): At centrality.c:2784 :closeness centrality is not
## well-defined for disconnected graphs
## 808 185 609 821 461 680
## 0.0001413028 0.0001412828 0.0001410636 0.0001408649 0.0001407856 0.0001405877
## 481 815 198 170
## 0.0001405284 0.0001404889 0.0001404692 0.0001403903
#Density of the Network
graph.density(g99)## [1] 0.02650602
#Degree Distribution of the network
degree.distribution(g99)## [1] 0.000000000 0.331325301 0.150602410 0.090361446 0.102409639 0.114457831
## [7] 0.018072289 0.030120482 0.036144578 0.012048193 0.018072289 0.012048193
## [13] 0.012048193 0.018072289 0.012048193 0.000000000 0.006024096 0.000000000
## [19] 0.000000000 0.006024096 0.012048193 0.006024096 0.000000000 0.000000000
## [25] 0.000000000 0.000000000 0.006024096 0.000000000 0.000000000 0.006024096
#Assortativity of the network
assortativity.degree(g99)## [1] 0.1199538
#Diameter of the network
diameter(g99)## [1] 8
Coloring with communities
Coloring with joining new nodes. Where, new nodes represented by the yellow color, while, old nodes are shown by the blue color.
#Top 10 Nodes, using Degree Centrality
sort(degree(g00),decreasing = TRUE)[1:10]## 680 461 857 61 1455 411 1319 1545 808 1078
## 39 34 31 30 29 28 27 27 25 25
#Top 10 Nodes, using Betweenness Centrality
sort(betweenness(g00),decreasing = TRUE)[1:10]## 680 857 461 1319 1078 2000 609 1455
## 2353.3523 2014.1286 1976.2214 1372.2272 1369.4223 1213.0000 1141.2204 1013.6211
## 1545 1534
## 948.0960 868.5746
#Top 10 Nodes, using Closeness Centrality
sort(closeness(g00),decreasing = TRUE)[1:10]## Warning in closeness(g00): At centrality.c:2784 :closeness centrality is not
## well-defined for disconnected graphs
## 680 461 857 1545 1319 1078
## 4.239444e-05 4.238006e-05 4.236211e-05 4.236032e-05 4.235135e-05 4.234597e-05
## 1455 411 427 609
## 4.234417e-05 4.233163e-05 4.232804e-05 4.232088e-05
#Density of the Network
graph.density(g00)## [1] 0.02041621
#Degree Distribution of the network
degree.distribution(g00)## [1] 0.000000000 0.415730337 0.093632959 0.123595506 0.059925094 0.033707865
## [7] 0.029962547 0.018726592 0.014981273 0.018726592 0.022471910 0.003745318
## [13] 0.022471910 0.029962547 0.003745318 0.011235955 0.007490637 0.014981273
## [19] 0.000000000 0.007490637 0.000000000 0.003745318 0.014981273 0.000000000
## [25] 0.007490637 0.011235955 0.000000000 0.007490637 0.003745318 0.003745318
## [31] 0.003745318 0.003745318 0.000000000 0.000000000 0.003745318 0.000000000
## [37] 0.000000000 0.000000000 0.000000000 0.003745318
#Assortativity of the network
assortativity.degree(g00)## [1] 0.06758523
#Diameter of the network
diameter(g00)## [1] 7
#computes broakrage