How can I arrange nodes in graphviz to make it look like 1?推荐答案如果目标是创建一个尊重节点顺序的图形,那就不是那么简单.您可以使用外部脚本计算节点的位置并使用neato渲染它.If the goal is to have a graph which respects the order of the nodes, it's not that simple. You could calculate the position of the nodes with an external script and render it with neato.或者您可以首先用仅确定节点正确顺序的边来布局节点:Or you could first layout the nodes with the edges which determine the correct order of the nodes only:digraph g1 { node [shape = doublecircle]; N4 N6; node [shape = circle]; edge[label="{1,0}"]; N0 -> N1 -> N2 -> N3 -> N4 -> N5 -> N6 -> N0;}具有:circo graph.gv > tempgraph.gv然后将其余边添加到tempgraph.gv-只需在结束}之前将以下内容复制粘贴:Then add the remaining edges to tempgraph.gv - just copy-paste the following before the closing }:N0 -> N4 [ label = "{1,0}"];N1 -> N5 [ label = "{1,0}"];N2 -> N6 [ label = "{1,0}"];N3 -> N0 [ label = "{1,0}"];N4 -> N1 [ label = "{1,0}"];N5 -> N2 [ label = "{1,0}"];N6 -> N3 [ label = "{1,0}"];并使用neato和-n选项进行渲染:And render it with neato and the -n option:neato -n tempgraph.gv -Tpng -O您可能希望微调标签的位置:You may want to fine-tune the position of the labels: 这篇关于Graphviz:如何以圆形布局布置节点的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持! 上岸,阿里云!
09-05 04:25