R 如何仅查找某些顶点的邻域?
问题开始了R 如何仅查找某些顶点的邻域?,r,igraph,R,Igraph,问题开始了 我有一个带有n的无向图g,函数是正确的,但第二个参数不是关于感兴趣的顶点,它是第三个: neighborhood # function (graph, order = 1, nodes = V(graph), mode = c("all", # "out", "in"), mindist = 0) # { # ... 因此, 他做这项工作 idv <- V(g)[strength(g)==2]; idv # 1 2 3 5 6 7 9 neigh<-nei
我有一个带有
n的无向图g
,函数是正确的,但第二个参数不是关于感兴趣的顶点,它是第三个:
neighborhood
# function (graph, order = 1, nodes = V(graph), mode = c("all",
# "out", "in"), mindist = 0)
# {
# ...
因此,
他做这项工作
idv <- V(g)[strength(g)==2]; idv # 1 2 3 5 6 7 9
neigh<-neighborhood(g, idv); neigh
neigh[[4]]; neigh[[8]];
#[1] 4 3 5 9
#[1] 8 1 7 9
neighborhood
# function (graph, order = 1, nodes = V(graph), mode = c("all",
# "out", "in"), mindist = 0)
# {
# ...
length(neighborhood(g, nodes = idv))
# [1] 7