如果我有以下代码:
g <- erdos.renyi.game(20, 50 , type = "gnm" , directed = F , loops = F) %>%
set_vertex_attr("a", value = 0)
total <- vcount(g)
V(g)$a <- sample(rep(0:2, c(1, total -5, 4)), total)
如何生成连接一个节点与属性的随机边缘&#34; a&#34;值为0的随机节点具有属性&#34; a&#34;值1?