Reputation: 3336
I would like to achieve either a) vertical edge labels or b) a horizontally extending tree in order to fit this graph on a single A4 page. How would I do it?
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 = "$"]
}
Upvotes: 3
Views: 2995
Reputation: 1617
rankdir=LR can let you fit it on one page
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
Upvotes: 3
Reputation: 56486
One possibility is to use the unflatten
utility.
For example:
unflatten -l 8 yourdotfile.gv | dot | neato -s -n2 -Tpng -o result.png
The resulting graph is not as wide as before.
Upvotes: 0
Reputation: 3336
One work-around I just discovered on the net was to seperate every character with a '\n' (eg. a newline character). It's not pretty, but it basically achieves vertical edge labels:
For example:
root -> 1 [label = "f\ng\nh\ni\nj\nk\nl\nm\nn\no\np\nq\nr\ns\nt\nu\nv\nw\nx\ny\nz\n$"]
Upvotes: 0