Note that there are some explanatory texts on larger screens.

plurals
  1. PONeed to control pydot edge length
    text
    copied!<p>Is there a way to use pydot to generate a directed tree graph that looks like "normal tree graphs" where every node of the same depth displays at the same depth, and every edge is at some angle (not straight down)?</p> <p>When I use these defaults:</p> <pre><code>graph = pydot.Dot(graph_type='digraph', nodesep=.75) graph.set_node_defaults(style="filled", fillcolor="grey") graph.set_edge_defaults(color="blue", arrowhead="vee", weight="0") </code></pre> <p>The length of the edge between nodes 2 and 1 is too long. See:<br> <img src="https://i.stack.imgur.com/Nx0HX.png" alt="enter image description here"></p> <p>I can correct the length of the node using an edge weight of "1" like:</p> <blockquote> <p>graph.set_edge_defaults(color="blue", arrowhead="vee", weight="1")</p> </blockquote> <p>But now two of the edges are pointing straight down between 2 and 3, and 7 and 6. See: <img src="https://i.stack.imgur.com/LEImS.png" alt="enter image description here"></p> <p>Edges pointing straight down turns out to be a real problem. If both left and right siblings are not drawn, then it is not clear which node (left or right) is drawn.</p> <p>PS: In my previous question on this same project I asked how to control the angle of edges so a pydot generated tree graph would avoid edges pointing straight down. That question was answered very well by "Guy". After implementing Guy's solution using invisible nodes, a new side effect has emerged: The length of some edges on some graphs have lengths that are too long. Here is a link to the prior question for reference: <a href="https://stackoverflow.com/questions/20533753/is-there-a-way-to-control-line-angle-when-producing-graphs-with-pydot">Is there a way to control line angle when producing graphs with pyDot</a></p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload