为网络图中的顶点分配一个(数字实数)值 [英] assign a (numeric real) value to vertex in network graph
问题描述
我想为网络图中的每个节点分配或关联R
中的某个实际值(例如某个分数).
需要在迭代中进行更新.
最后根据其最新值(得分)绘制具有顶点大小的网络图.
I wanted to assign or associate each node in the network plot with some real value (say some score) in R
.
Which need to be updated in iterations.
Finally to plot the network graph with size of vertex according to its latest value (score).
可以用于此目的的顶点的哪个属性?如何使用?
如果在igraph
中不可能,在R
中还有其他方法可以实现此目的吗?
Which property of a vertex I can use for this purpose and how?
If it's not possible in igraph
, is there any other way to achieve this purpose in R
?
我是R
的新手.任何人都可以帮助我解决这个问题.
I'm new to R
. Anybody please help me to sort out this problem.
推荐答案
我创建我的差距
graph2 <- read.table(text = '1 2
1 3
2 5
3 4
3 5
4 5
5 6 ')
par(mfrow =c(1,2))
graph2 <- graph.data.frame(graph2,
vertices = data.frame(symbols = 1:6,label = 1:6),directed=FALSE)
plot(graph2,main='simple graph')
我更改了weight属性,在这里您可以进行适当的压缩过程
I change the weight property , here you can pput yor proper compting process
E(graph2)$weight <- seq(ecount(graph2))
graph.strength(graph2)
我修改属性宽度,以可视化权重效果
I modify property width, to visualize the weight effect
E(graph2)$width <-E(graph2)$weight
plot(graph2,main='weighted graph')
这篇关于为网络图中的顶点分配一个(数字实数)值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!