Union of igraph objects loses attributes

风格不统一 提交于 2019-11-29 15:54:06

igraph doesn't loose the colors, it stores them in $color_1 and $color_2. I think this is because in the general case there might be common vertices with different colors. What would you do then?

Try this:

V(graph)$color <- ifelse(is.na(V(graph)$color_1),
                         V(graph)$color_2,V(graph)$color_1)
plot(graph)

BTW: your code didn't run for me. I had to use:

graph <- graph.union(graph.1, graph.2, byname=T)
标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!