edge_density(g, loops = F)
## [1] 0.06060606
eigen_centrality(g)$vector
## 3 54 108 152 178 182 214 271
## 1.0000000 0.3244157 0.2071806 0.2071806 0.2071806 0.2071806 0.2071806 0.2071806
## 286 300 348 349 371 567 581 584
## 0.2071806 0.2071806 0.2071806 0.2071806 0.2071806 0.2071806 0.2071806 0.2071806
## 586 590 604 611 8283 25 6 8
## 0.2071806 0.2071806 0.2071806 0.2071806 0.2071806 0.5658592 0.1172351 0.1172351
## 19 23 28 29 30 33 35 50
## 0.1172351 0.1172351 0.1172351 0.1172351 0.1172351 0.1172351 0.1172351 0.1172351
## 55 56
## 0.1172351 0.1172351
E(g)[[inc('54')]]
## + 2/34 edges from 88cbac9 (vertex names):
## tail head tid hid
## 1 3 54 1 2
## 2 54 25 2 22
V(g)$color <- ifelse((V(g)$name =="54"), "red", "white")
plot(g, vertex.label.color = "black")
V(g)$color <- ifelse((V(g)$name =="25"), "pink", "white")
plot(g, vertex.label.color = "black")
You can also embed plots, for example:
## $res
## [1] 21 2 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 14 1 1 1
## [26] 1 1 1 1 1 1 1 1 1
##
## $centralization
## [1] 0.5757576
##
## $theoretical_max
## [1] 1122
edges <- graph_from_data_frame(d=dfdata, directed = F)
plot(edges)
density<- edge_density(edges)
density
## [1] 0.06060606
centrality <- centralization.betweenness(edges)
centrality
## $res
## [1] 437 318 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
## [20] 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
##
## $centralization
## [1] 0.8094008
##
## $theoretical_max
## [1] 17424
’’’{r}
dfdata.mat <- as.matrix(data) g <- graph.edgelist(dfdata.mat, directed=FALSE) plot(g)
edge_density(g, loops = F)
eigen_centrality(g)$vector
E(g)[[inc(‘54’)]]
V(g)\(color <- ifelse((V(g)\)name ==“54”), “red”, “white”) plot(g, vertex.label.color = “black”)
V(g)\(color <- ifelse((V(g)\)name ==“25”), “pink”, “white”) plot(g, vertex.label.color = “black”)
’’’
’’’{r}m <- graph_from_adjacency_matrix(matrix(0:1), 5, 5), mode=“undirected”) plot(m)
inc.edges <- incident(m, V(m)[2], mode=“all”)
ecol <- rep(“gray80”, ecount(m))
ecol[inc.edges] <- “orange”
vcol <- rep(“grey40”, vcount(m)) vcol[V(m)[2]] <- “gold” plot(m,vertex.color=vcol,edge.color=ecol) ’’’