合并R igraph ggnet2中的两个网络

时间:2018-06-15 16:34:52

标签: r igraph ggnetwork

我需要在R中加入两个网络图,只需在第一个上叠加第二个。

我与你分享更多的声音: 我的第一个图是这种形式的最大生成树:

g1 <- graph_from_adjacency_matrix(m4, mode = "upper", weighted = T, diag = F)
max_spann_tree2 <- mst(g1, weights = -E(g)$weight)

max_spann_tree2<-asNetwork(max_spann_tree2)
ggnet2(max_spann_tree2 ,size =  nlav1,size.cut = 4, edge.size = 1, edge.color = "grey", color = "he1", color.legend = "industry", palette = "Set3")

max_spann_tree2具有以下结构:

 > max_spann_tree2
     Network attributes:
      vertices = 181 
      directed = FALSE 
      hyper = FALSE 
      loops = FALSE 
      multiple = FALSE 
      bipartite = FALSE 
      total edges= 180 
        missing edges= 0 
        non-missing edges= 180 

 Vertex attribute names: 
    he1 vertex.names

我需要覆盖这个图

net55<-asNetwork(net5)
ggnet2(net55 ,size =  nlav5,size.cut = 4, edge.size = 1, edge.color = "grey", color = "he5", color.legend = "industry", palette = "Set3")

net5具有以下结构:

> net5

IGRAPH 3893673 UNW- 87 250 -- 
+ attr: name (v/c), he (v/c), nlav (v/n), ateco (v/c), weight (e/n)
+ edges from 3893673 (vertex names):
 [1] A1013--A1621 A1039--A1051 A1039--A1089 A1041--A1051 A1041--A1061 A1041--A1071 A1041--A1073 A1041--A2312
 [9] A1041--A2369 A1041--A2370 A1041--A2512 A1041--A6910 A1041--A6920 A1041--A7112 A1051--A2512 A1051--A7420
+ ... omitted several edges

我尝试使用uniongraph但没有成功。合并这两个情节的任何建议?我可以直接合并两个ggnet2图吗?或者我应该做些什么? 提前谢谢

0 个答案:

没有答案