Hen*_*nka 16 r igraph bipartite
我的一般问题是,当使用iGraph生成图形时,我松开了顶点名称/标签(这里不确定正确的单词).
我有一个二分网络的边缘列表IC_edge_sub,如下所示:
new_individualID new_companyID
1 <NA> 10024354c
3 10069415i 2020225c
4 10069415i 16020347c
5 10069272i 2020225c
6 10069272i 16020347c
7 10069274i 2020225c
Run Code Online (Sandbox Code Playgroud)
然后我创建一个图元素:
IC_projected_graphs <- bipartite.projection(IC_twomode, types =
is.bipartite(IC_twomode)$type)
Run Code Online (Sandbox Code Playgroud)
然后折叠它以仅识别companyID之间的连接
IC_projected_graphs <- bipartite.projection(IC_twomode, types =
is.bipartite(IC_twomode)$type)
Run Code Online (Sandbox Code Playgroud)
然后得到邻接矩阵:
CC_matrix_IC_based <- get.adjacency(CC_graph_IC_based); CC_matrix_IC_based
Run Code Online (Sandbox Code Playgroud)
在iGraph中,节点编号从零开始,因此矩阵命名也从零开始.但是,我现在需要在最终的CC_matrix_IC_based矩阵中的edgelist的第二列中指定的"new_companyID".
你能帮助我如何使用原始边缘列表中的信息在最终的邻接矩阵中放入rownames和colnames吗?
我用Google搜索并搜索了堆栈流,但无法找到合适的答案.非常感谢你的帮助
Tam*_*más 24
顶点名称通常存储name在igraph中命名的顶点属性中.因此,如果您的图表存储在变量中g,那么您可以使用它V(g)$name来检索所有顶点的名称.
| 归档时间: |
|
| 查看次数: |
18846 次 |
| 最近记录: |