【发布时间】:2015-05-03 06:13:06
【问题描述】:
我在 rgraphviz 中有一个有向无环图,它将被渲染为 DOT 图。我想根据节点的等级来控制节点的外观。如何找到节点的等级?
【问题讨论】:
标签: r graphviz dot rank directed-acyclic-graphs
我在 rgraphviz 中有一个有向无环图,它将被渲染为 DOT 图。我想根据节点的等级来控制节点的外观。如何找到节点的等级?
【问题讨论】:
标签: r graphviz dot rank directed-acyclic-graphs
这是我的答案。欢迎提出建议。
gR 是形式类 GRAPHNEL 的对象
gx <- layoutGraph(gR) #can also add node attributes, sublists here
x <- gx@renderInfo@nodes$nodeX
y <- gx@renderInfo@nodes$nodeY
#x and y are named vectors with node names and x / y coordinates
#to get the names of the nodes on the top rank:
topNodes1 <- names(y[y==max(y)])
【讨论】: