2
分配()的屬性,例如寬度:[R的igraph add.edges()的屬性add.edges期間
g <- add.edges(g,c(from,to), attr= width <- 1)
Error message:
please supply names for attributes
分配()的屬性,例如寬度:[R的igraph add.edges()的屬性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
。
謝謝:作品!但是將c(1,2)改爲c(0,1)。因爲igraph以'0'開始計數 – 2012-07-20 14:28:30
不再在最新版本的igraph中。 igraph0'包現在可以做到這一點。 – 2012-07-20 18:02:10
真的,我只是通過istall.packages('igraph')更新它。仍舊是舊式的標籤。 – 2012-07-23 06:28:28