Plot tree with graph.tree function from igraph

拟墨画扇 提交于 2019-11-29 21:15:32

问题


In the docs of igraph package there is an example

igraph.options(plot.layout=layout.reingold.tilford)
plot(graph.tree(20, 2))

the output should represent data as a tree. But what I get is


回答1:


You apparently need to specify the root:

library(igraph)
g <- graph.tree(20, 2)
plot(g, layout = layout.reingold.tilford(g, root=1))



来源:https://stackoverflow.com/questions/18270370/plot-tree-with-graph-tree-function-from-igraph

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