I would like to force dot displaying only vertical or horizontal edges between nodes.
I have found a similar request with the post Family tree layout with Dot/GraphViz, but I am not dealing with trees, so I hope there is a solution without inserting extra nodes...
If I build the following graph:
digraph G { splines=ortho A [ shape=box ] B [ shape=box ] C [ shape=box ] D [ shape=box ] A -> B A -> C B -> D C -> D }
What I get is this:
But I would like a graph like this one:
How can I get such a rendering ?
Edit : the "splines" attribute seems not working as expected... Is there something I did wrong ?
Your syntax seems correct. When I run it I get orthogonal edge routing (of sorts):
Which version do you have?
I ask because orthogonal edge routing is only available in Graphviz versions from September 28, 2010 and newer. Not all systems have more recent versions packed. On my system I had to download and manually install Graphviz to get a version newer than 2.26.3 (which is from January 26, 2010).
Assuming your actual graph contains more than 4 nodes, if you want the lines to have a bend and you don't want to add extra (invisible) nodes, you should try playing around with the
graphs nodesep
attribute. See code and image below.
digraph G {
graph [splines=ortho, nodesep=1]
node [shape=record]
A -> {B, C} -> D
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With