我正在尝试将图形与graph.union
iGraph 结合起来,但是当我这样做时,生成的图形不会保留其顶点标签。
testGraph1 = barabasi.game(3,
m = 5,
power = 0.6,
out.pref = TRUE,
zero.appeal = 0.5,
directed = TRUE)
V(testGraph1)$name = c('one', 'two', 'three')
testGraph2 = barabasi.game(5,
m = 5,
power = 0.6,
out.pref = TRUE,
zero.appeal = 0.5,
directed = TRUE)
V(testGraph2)$name = c('one', 'two', 'three', 'four', 'five')
combine = graph.union(testGraph1, testGraph2)
V(combine)$name #Is NULL
我也尝试过使用graph.union.by.name
,但我认为有一个错误,因为两个测试图都是有方向的,但我遇到了一个奇怪的错误。
combine = graph.union.by.name(testGraph1, testGraph2)
#Error: !is.directed(g1) & !is.directed(g2) is not TRUE