问题描述
我正在尝试绘制一个图形,其中顶点之间的距离对应于边缘权重*,我发现在graphviz中可以绘制这种图形。有没有办法在R中使用igraph包(特别是带有graph.adkacency)做到这一点?
I'm trying to draw a graph where the distance between vertices correspond to the edge weights* and I've founde that in graphviz there is a way to draw such graph. Is there a way to do this in R with the igraph package (specfically with graph.adkacency)?
谢谢,
诺姆
- (一次被问到:)
- (as once have been asked: draw a graph where the distance between vertices correspond to the edge weights)
推荐答案
这是不可能的,因为您需要每个三角形的三角形相等才能绘制这样的对象。因此,您只能进行近似估算。为此,您可以使用强制嵌入算法。图中有一些。我经常使用的是Fruchterman-Reingold算法。
This is not possible as you need triangle equality for every triangle to be able to plot such an object. So you can only approximate it. For this you can use "force embedded" algorithms. There are a few in igraph. The one I often use is the Fruchterman-Reingold algorithm.
有关详细信息,请参见:
See for details:
library("igraph")
?layout.fruchterman.reingold
编辑:
请注意,节点之间的距离将与绝对边权重的倒数相对应。
Note that the distance between nodes will correspond somewhat with the inverse of the absolute edge weight.
这篇关于根据权重可视化节点之间的距离-使用R的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!