两个顶点之间的图形边缘 [英] igraph edge between two vertices

查看:177
本文介绍了两个顶点之间的图形边缘的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是R和igraph的新手,我想知道是否有人可以帮助我进行以下工作?

I'm new to R and igraph and I was wondering if anybody can help me with the following.

我想找到图中两个顶点之间的边缘权重.我的图结构由正常的自我(node1),alter(node2)以及它们之间边缘的权重定义.

I want to find the edge weight between two vertices in a graph. My graph structure is defined by the normal ego (node1), alter (node2) and the weight of the edge between them.

我知道我可以使用 E(igraph_friendship)[from(5)] $ weight 获得来自节点编号5的边列表中每个边的权重. 而且我可以使用 E(igraph_friendship)[to(10)] $ weight

I know that I can get the weight for each of the edges in the list of edges that originate from node number 5 using E(igraph_friendship) [ from(5) ]$weight And that I can find the weight for each of the edges in the list of edges that end onto node number 10 using E(igraph_friendship) [ to(10) ]$weight

但是,如果我只是想找到简单地仅连接节点5和节点10的边缘的权重,该怎么办?

But what if I simply want to find the weight of the edge that simple connects just node 5 and node 10?

或者,如果我可以在所有边的列表中得到连接节点5和10的边的标识符 E(igraph_friendship),那也可以.

Alternatively, if I can get the identifier of the edge that connects node 5 and 10 in the list of all edges, E(igraph_friendship), that would work too.

非常感谢您的帮助,我一直在寻找很多帮助,非常感谢您的帮助!

Thanks a lot for your help, I've been looking around a lot for it and I really appreciate your help!

推荐答案

Gabor使用邻接矩阵很有帮助.但是,花了我一段时间才弄清楚如何将具有权重的边列表添加到邻接矩阵中.我尝试使用graph.data.frame进行常规操作,但是当我尝试将igraph对象转换为邻接矩阵时会出现一个奇怪的错误(错误:.M.kind(x)中的错误:尚未针对矩阵实现w/typeof字符).这篇文章有助于解决问题: https://sites.google.com/网站/daishizuka/toolkits/sna/weighted-edgelists .

Gabor's use of the adjacency matrix helped. However, it took me a while to figure out how to get my edge lists with weights into an adjacency matrix. I tried to do it the usual way using graph.data.frame but then would get a weird error when I tried translating the igraph object to and adjacency matrix (error: Error in .M.kind(x) : not yet implemented for matrix w/ typeof character). This post helped do the trick: https://sites.google.com/site/daishizuka/toolkits/sna/weighted-edgelists.

但是,我从R帮助电子邮件列表中发现最有效的帮助是直接在igraph对象上使用了这个简单的运算符:E(g)[5%-%10] $ weight.请参见 http://igraph.sourceforge.net/doc/R/iterators.html了解详情

However, what I found out from the R help email list help to work best was this simple operator directly on the igraph object: E(g)[5 %--% 10]$weight. See http://igraph.sourceforge.net/doc/R/iterators.html for details

这篇关于两个顶点之间的图形边缘的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆