R中的igraph对象“深度”是什么意思

问题描述

以下是可重现的示例,该示例是根据我从https://www.r-graph-gallery.com/circle-packing.html获得的火炬数据集制作“环形堆积”图的。

library(ggraph)
library(igraph)
library(tidyverse)
library(viridis)

# We need a data frame giving a hierarchical structure. Let's consider the flare dataset:
edges=flare$edges
vertices = flare$vertices
mygraph <- graph_from_data_frame( edges,vertices=vertices )

# Hide the first level (right)
ggraph(mygraph,layout = 'circlepack',weight=size) + 
  geom_node_circle(aes(fill = as.factor(depth),color = as.factor(depth) )) +
  scale_fill_manual(values=c("0" = "white","1" = viridis(4)[1],"2" = viridis(4)[2],"3" = viridis(4)[3],"4"=viridis(4)[4])) +
  scale_color_manual( values=c("0" = "white","1" = "black","2" = "black","3" = "black","4"="black") ) +
  theme_void() + 
  theme(legend.position="FALSE") 

# Second one: hide 2 first levels
ggraph(mygraph,"1" = "white","2" = magma(4)[2],"3" = magma(4)[3],"4"=magma(4)[4])) +
  scale_color_manual( values=c("0" = "white","4"="black") ) +
  theme_void() + 
  theme(legend.position="FALSE")

我似乎无法理解mygraph对象中哪个ggraph调用"depth"变量,因为当我检查mygraph时,似乎没有对象与“深度”相关,如下所示:

> str(mygraph)
List of 10
 $ :List of 1
  ..$ flare.analytics.cluster.AgglomerativeCluster: 'igraph.vs' Named int(0) 
  .. ..- attr(*,"names")= chr(0) 
  .. ..- attr(*,"env")=<weakref> 
  .. ..- attr(*,"graph")= chr "f790c97f-1438-11eb-95c4-9dc043ced32f"
 $ :List of 1
  ..$ flare.analytics.cluster.CommunityStructure: 'igraph.vs' Named int(0) 
  .. ..- attr(*,"graph")= chr "f790c97f-1438-11eb-95c4-9dc043ced32f" (deprecated)

有人可以告诉我"depth"在这种情况下是什么意思吗?预先感谢

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)