根据矢量选择顶点序列 - bibcoupling

时间:2016-08-26 12:03:21

标签: r igraph

我有一个包含数千个顶点(“作者”)和边缘(“引用”)的图形。我想计算作者的特定子集的书目耦合(cmd:bibcoupling);选择我计划使用包含感兴趣的作者的向量的子集。

如何使用向量选择感兴趣的顶点序列?

rm(list=ls())
library("igraph")

g <- make_ring(10) %>%
set_vertex_attr("label", value = letters[1:10])

#Vertex sequence of interest
s_lab<-c("a","b","f") 
s_ind<-c(1,2,6)

#I would like to replicate these outputs using the vectors s_lab and s_ind
bibcoupling(g,v=V(g)[label=="a" | label== "b" | label=="f"])
bibcoupling(g,v=V(g)[1,2,6])

非常感谢您的投入,我非常感谢!

1 个答案:

答案 0 :(得分:0)

如果我理解正确,您希望在图表的子集中使用s_labs_ind个对象,而不是[之间的长硬编码表达式。如果是这样,那么类似的东西可以解决问题:

bibcoupling(g,v=V(g)[label %in% s_lab])
bibcoupling(g,v=V(g)[s_ind])

对不起,如果我误解了。

相关问题