我想通过将图的节点连接到另一个图来连接两个独立的图
例如,我有两个图 G & H
G = 1-3,1-5,5-9,5-21,21-22 H = 0-31,31-32,31-34,31-35,35-88
我想通过将图 H 的节点 0 连接到图 G 的节点 5 将图 H 与图 G 链接起来
1-3,1-5,5-9,5-21,21-22,5-0, 0-31,31-32,31-34,31-35,35-88
你可以尝试disjoint_union+add_edges
> add_edges(disjoint_union(G, H), c("0", "5"))
IGRAPH 6cbfa1f UN-- 12 11 --
+ attr: name (v/c)
+ edges from 6cbfa1f (vertex names):
[1] 1 --3 1 --5 5 --9 5 --21 21--22 0 --31 31--32 31--34 31--35 35--88
[11] 5 --0
Run Code Online (Sandbox Code Playgroud)