R igraph add.edges() 与属性

标签 r attr igraph 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

关于R igraph add.edges() 与属性,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11577830/

相关文章:

r - 将 sjPlot::tab_model 表 ta 的列表保存到 Word 文件或 RMarkdown 文件中

r - 如何阻止使用 lattice 包制作的 R 中的水平图的一部分?

R ggplot2 堆叠条形图按列值归一化

Vertex 中的 R iGraph 热图

用于创建和可视化 HyperGraph 的 Python 库

algorithm - 涉及 3 个硬币的 EM 问题

jQuery attr() 函数是跨平台独立的不是

jQuery 代码在激活两次时加倍 Action

java - 如何将正确的文本设置为 textView(我在 textView 的方向设置了 RTL)

python - 在 igraph python 中访问有边的节点到某个感兴趣的节点