R/Igraph在边列表中显示边权重吗? [英] R/Igraph Display edge weights in an edge list?
本文介绍了R/Igraph在边列表中显示边权重吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
将图形对象作为边缘列表查看时,有什么方法可以显示边缘权重?
Is there any way to display edge weights when viewing the graph object as an edge list?
我想本着以下的精神做某事:
I want to do something in the spirit of:
get.edgelist(graph, attr='weight')
以查看边缘配对,并在节点旁边列出权重,但这似乎是不允许的.我知道如何查看权重的唯一方法是将网络数据视为邻接矩阵.希望这不是唯一的方法.
so as to view the edge pairings with the weights listed alongside the nodes, but that seems not to be allowed. Only way I know how to view the weights is to view the network data as an adjacency matrix. Hoping that's not the only way.
推荐答案
使用帮助页面中pkg:igraph:
Using the example in the help page for function get.edgelist
in pkg:igraph:
> cbind( get.edgelist(g) , round( E(g)$weight, 3 ))
[,1] [,2] [,3]
[1,] "a" "b" "0.342"
[2,] "b" "d" "0.181"
[3,] "b" "e" "0.403"
[4,] "b" "f" "0.841"
[5,] "d" "f" "0.997"
[6,] "e" "g" "0.029"
[7,] "a" "h" "0.17"
[8,] "b" "j" "0.69"
[9,] "g" "j" "0.422"
这篇关于R/Igraph在边列表中显示边权重吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文