微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

如何使用 R igraph 包计算度数、特征向量、bonacich 幂中心性?

如何解决如何使用 R igraph 包计算度数、特征向量、bonacich 幂中心性?

我正在尝试使用 R 中的 igraph 包计算度中心性、特征向量中心性和 Bonacich 功率中心性。我的数据是韩国的通勤数据。

我的数据看起来像这样1st column: orientation region code,2nd column: destination region code,3rd column: commuting times between the two regions

我使用函数 graph_from_data_frame() 制作了 igraph 图,如下图所示。 od18 is the data I used. The same one mentioned at the first picture. 但这是我的问题。

  1. 我无法使用此图制作邻接矩阵。

: get.adjacency.sparse(graph,type = type,attr = attr,edges =edges,: 稀疏矩阵必须是数值型或逻辑型,边属性不是

this is the code I executed. this is the error.

其实,如果中心性计算没有问题,我并不关心邻接矩阵。但我担心如果这意味着我不会得到中心性计算的正确结果。

  1. 我尝试使用函数 degree() 计算度中心性,但结果值都相同。 All of my nodes have the same degree values as 250.

  2. 有关使用 -beta 的 Bonacich 权力中心性的任何帮助。

你能帮我解决这些问题吗?

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。