繁体   English   中英

具有孤立顶点/节点的归一化度中心性度量(r igraph)

[英]Normalized degree centrality measures with isolated vertices/nodes (r igraph)

我对网络分析很陌生。 我想用 R 计算归一化中心性度量(度、介数和特征向量)。 我创建了以下边缘列表,其中 ID1 和 ID2 都是投资者。 如果 ID1 和 ID2 都填充,投资者共同投资,否则,投资者单独投资(即孤立节点):

edgelist <- structure(list(ID1 = c("Cottonwood Capital Partners LLC", "Sequoia Capital Operations LLC", 
                   "Seraphim Capital (General Partner) LLP", "Seraphim Capital (General Partner) LLP", 
                   "Providence Equity Partners LLC", "Turn8", "Matrix Partners LP", 
                   "Zeeuws Investeringsfonds BV", "Venionaire Capital GmbH", "CincyTech", 
                   "First Round Capital", "Matrix Partners LP", "Mohr Davidow Ventures", 
                   "Esprit Capital Partners LLP", "Yaletown Venture Partners", "Wellington Partners", 
                   "Charles River Ventures LLC", "MB VENTURE PARTNERS L L C", "Edison Partners", 
                   "Ballast Point Venture Partners LLC", "Arcview Group", "Foundry Group LLC", 
                   "Sosventures LLC", "Vantagepoint Management Inc", "Bain Capital Venture Partners LLC", 
                   "NAV VC", "Bluerun Ventures LP", "Draper Fisher Jurvetson International Inc", 
                   "Claremont Creek Ventures LP", "Meritage Funds"), ID2 = c("Pangaea Ventures Ltd", 
                                                                             NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, "RPM Ventures Management LLC", 
                                                                             NA, "Kennet Partners Ltd", NA, NA, "Gotham Ventures LLC", NA, 
                                                                             NA, NA, "Syncom Management Co Inc", "Lightspeed Venture Partners China Co Ltd", 
                                                                             NA, "First Round Capital", NA)), row.names = c(NA, -30L), class = c("tbl_df", 
                                                                                                                                                 "tbl", "data.frame"))

为了计算归一化度中心性,我使用以下代码:

library(igraph)
net <- graph.data.frame(edgelist, directed = F) # create undirected graph

"Warning message:
In graph.data.frame(edgelist, directed = F) :
In `d' `NA' elements were replaced with string "NA""

degree_norm <- degree(net, mode = "all", normalized = T) # retreive normalized degree measure
betw_norm <- betweenness(net2, directed=F, normalized = T) # retreive normalized betw measure
ev <- eigen_centrality(net2, directed = F, scale=F, weights = NULL) # retreive normalized ev

如您所见,出现Warning message :它将NA视为单独的投资者(它将NA变为字符串)。 我保持孤立投资者的原因是标准化需要将原始程度度量(使用连接的节点/投资者计算的)除以任何投资者可能投资的投资者的可能数量(即所有可能的投资者,计算那些投资的投资者)独自的)。

关于如何规避此类问题的任何建议? 我尝试使用邻接矩阵,但也无法弄清楚......

非常感谢!

使用igraph时,处理与其他节点没有连接的节点的正确方法是传入一个顶点列表。 使用您提供的数据:

# first get a list of all the nodes, excluding the NA
nodeslist <- data.frame(name= na.omit(unique(c(edgelist$ID1,edgelist$ID2 ))))

# delete the NAs from the edge list
edgelist <- na.omit(edgelist)

# create the `igraph` object
g <- graph_from_data_frame(edgelist,
                           directed = F,
                           vertices = nodeslist)

# compute normalized degree
V(g)$degree <- igraph::degree(g, mode = "all", normalized = T)

# explore the result: there are 34 nodes, and the (not-normalized) degree of all nodes
# is either 0 or 1. Therefore, the normalized degree should be either 1/33=0.03030303 or 0:
V(g)$degree
 [1] 0.03030303 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000
 [8] 0.00000000 0.00000000 0.03030303 0.00000000 0.00000000 0.00000000 0.00000000
[15] 0.03030303 0.00000000 0.03030303 0.00000000 0.00000000 0.03030303 0.00000000
[22] 0.00000000 0.00000000 0.03030303 0.03030303 0.00000000 0.03030303 0.00000000
[29] 0.03030303 0.03030303 0.03030303 0.03030303 0.03030303 0.03030303

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM