How can I achieve strict reverse ranking of graphviz dot?

非 Y 不嫁゛ 提交于 2019-12-24 19:16:27

问题


Edit: If posted a new question to supersede this question. Align Ranks in Graphviz

First, let me apologize for inventing/abusing some terminology in the title. By "strict" I mean all nodes of the same rank need the same y position in the output image, whereas by default they are shifted around slightly. Second, by "reverse" I mean all the leafs are the same rank, appearing at the same row at the bottom of the graph, and all of their ancestors to be ranked and aligned accordingly (without reversing the edge directions). The graphs I'm working with are bounded semilattices, so there's no cyclical portions and all nodes have a well defined rank.

I tried reversing the edge direction (and "dir=back" can make the edges look like the original direction), but the "strict" part is still a problem


回答1:


How to put all the leaves on the bottom (max) rank ?

You may include a subgraph containing all the leave nodes and add the attribute rank=max:

{
    rank=max;
    leaf1; leaf2; leaf3;
}

This should place all your leaf-nodes on the bottom.




回答2:


I ended up changing the algorithm that generates the graphviz to place several { rank = same; ... } items in the output



来源:https://stackoverflow.com/questions/47396374/how-can-i-achieve-strict-reverse-ranking-of-graphviz-dot

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