Итак, передо мной была поставлена задача воссоздать определенную сеть, как показано здесь:
Хотя мне удалось выяснить, как поиграться с узлами, яне знаете, как назначить каждое ребро ширине. Я предполагаю, что это должно быть сделано аналогично цвету / форме узла, который хранится как вектор. Тем не менее, как я точно знаю, что это за край?
library(sna)
hw2 <- rbind(
# 1 2 3 4 5 6 7 8 932 1 2 3 4 8 0 2
c(0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1),
c(1,0,1,1,0,0,0,1,0,0,0,0,0,1,1,1,1),
c(1,1,0,1,0,0,0,1,1,0,0,0,0,1,0,0,0),
c(1,1,1,0,0,0,0,1,0,0,0,0,1,1,0,0,0),
c(1,0,0,0,0,0,1,0,0,0,1,0,0,0,0,0,0),
c(1,0,0,0,0,0,1,0,0,0,1,0,0,0,0,0,0),
c(1,0,0,0,1,1,0,0,0,0,0,0,0,0,0,0,0),
c(1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0),
c(1,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0),
c(1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0),
c(1,0,0,0,1,1,0,0,0,0,0,0,0,0,0,0,0),
c(1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0),
c(1,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0),
c(1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0),
c(1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0),
c(1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0),
c(1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0)
)
#Labels
rownames(hw2) <- c("a1","a2","a3","a4","a5","a6","a7","a8","a9","a32","a11","a12","a13","a14","a18","a20","a22")
colnames(hw2) <- c("a1","a2","a3","a4","a5","a6","a7","a8","a9","a32","a11","a12","a13","a14","a18","a20","a22")
#Colors
net_col <- c(rep("steelblue",8),rep("lightcoral",2),rep("steelblue",8))
edge_col <- c(rep("blue4",) )
#Shape
net_size <-c(rep(4,8),rep(50,2),rep(4,8))
#Network
net_hw2 <- network(hw2,matrix.type="adjacency")
#Graph 1 , similar to existing graph
gplot(net_hw2,vertex.col = net_col,usearrows = F,displaylabels = T,label.pos = 5,
vertex.cex = 3, vertex.sides = net_size)