gpt4 book ai didi

graphviz - 使 Graphviz 边缘标签垂直(或使树水平延伸)

转载 作者:行者123 更新时间:2023-12-04 05:32:43 24 4
gpt4 key购买 nike

我想实现 a) 垂直边缘标签或 b) 水平延伸的树,以便将此图形放在单个 A4 页面上。我该怎么做?

digraph g {
node[shape=point]
root -> 1 [label = "abcdefghijklmnopqrstuvwxyz$"]
root -> 2 [label = "bcdefghijklmnopqrstuvwxyz$"]
root -> 3 [label = "cdefghijklmnopqrstuvwxyz$"]
root -> 4 [label = "defghijklmnopqrstuvwxyz$"]
root -> 5 [label = "efghijklmnopqrstuvwxyz$"]
root -> 6 [label = "fghijklmnopqrstuvwxyz$"]
root -> 7 [label = "ghijklmnopqrstuvwxyz$"]
root -> 8 [label = "hijklmnopqrstuvwxyz$"]
root -> 9 [label = "ijklmnopqrstuvwxyz$"]
root -> 10 [label = "jklmnopqrstuvwxyz$"]
root -> 11 [label = "klmnopqrstuvwxyz$"]
root -> 12 [label = "lmnopqrstuvwxyz$"]
root -> 13 [label = "mnopqrstuvwxyz$"]
root -> 14 [label = "nopqrstuvwxyz$"]
root -> 15 [label = "opqrstuvwxyz$"]
root -> 16 [label = "pqrstuvwxyz$"]
root -> 17 [label = "qrstuvwxyz$"]
root -> 18 [label = "rstuvwxyz$"]
root -> 19 [label = "stuvwxyz$"]
root -> 20 [label = "tuvwxyz$"]
root -> 21 [label = "uvwxyz$"]
root -> 22 [label = "vwxyz$"]
root -> 23 [label = "wxyz$"]
root -> 24 [label = "xyz$"]
root -> 25 [label = "yz$"]
root -> 26 [label = "z$"]
root -> 27 [label = "$"]

最佳答案

rankdir=LR 可以让你把它放在一页上

digraph g {
graph[rankdir=LR]
node[shape=point]
root -> 1 [label = "abcdefghijklmnopqrstuvwxyz$"]
root -> 2 [label = "bcdefghijklmnopqrstuvwxyz$"]
...
}

http://www.graphviz.org/doc/info/attrs.html#d:rankdir

关于graphviz - 使 Graphviz 边缘标签垂直(或使树水平延伸),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12369799/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com