在 add.edges() 期间分配一个属性,例如宽度:
g <- add.edges(g,c(from,to), attr= width <- 1 )
Error message:
please supply names for attributes
最佳答案
您需要为其分配一个命名列表:
g <- graph.adjacency(matrix(0,2,2))
g <- add.edges(g,c(1,2),attr=list(width=10))
使用您使用的代码,将 1
分配给变量 width
,然后分配 width
的值,即 1
,到参数 attr
。
关于R igraph add.edges() 与属性,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11577830/