首页 > 解决方案 > 相邻顶点表格 igraph 不能处理传入的关系?

问题描述

使用包中的选项“in”adjacent_vertices确实igraph会为顶点 5 提供输出,即使它应该列出 1、2、3、4。

g <- make_graph(c(1, 2, 2, 3, 3, 4, 5, 6), directed = T)
adjacent_vertices(g, v= c(5), mode = "in")

# output 
[[1]]
+ 0/6 vertices, from 3aecb67:

但是对于无向图,它可以工作:

g <- make_graph("Zachary")
adjacent_vertices(g, c(1, 34))

# output 
[[1]]
+ 16/34 vertices, from 4414f0d:
 [1]  2  3  4  5  6  7  8  9 11 12 13 14 18 20 22 32

[[2]]
+ 17/34 vertices, from 4414f0d:
 [1]  9 10 14 15 16 19 20 21 23 24 27 28 29 30 31 32 33

为什么是这样?还有哪些其他方法可以识别传入关系序列中的所有顶点?

标签: rnetworkinggraphigraph

解决方案


推荐阅读