为网络图中的顶点分配一个(数字实数)值

编程入门 行业动态 更新时间:2024-10-25 16:27:12
本文介绍了为网络图中的顶点分配一个(数字实数)值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我想为网络图中的每个节点分配或关联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')

更多推荐

为网络图中的顶点分配一个(数字实数)值

本文发布于:2023-07-18 20:11:59,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1148595.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:实数   顶点   图中   分配   数字

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!