Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>In response to the updated constraints, one solution is to pin A and X, and then lay out the graph around them:</p> <pre><code>graph sample { overlap=false; splines=true; tailclip=false; headclip=false; A [pin=true,pos="0,.2"] X [pin=true,pos="0,.1"] A -- I A -- J A -- B A -- H A -- E A -- K B -- D B -- C B -- L C -- M C -- N C -- O D -- P D -- Q E -- R F -- A G -- F H -- J A -- X </code></pre> <p><img src="https://i.stack.imgur.com/YSFCM.png" alt="graph output"></p> <p>I tried layout with both neato and fdp, and it seems to produce a graph like what you want. Naturally, if you want to impose such a constraint on arbitrary pairs of nodes in the same graph, this solution may not work.</p> <p>--- Earlier answer ---</p> <p>If you're committed to using neato, I'm not certain there is a way to solve the problem without modifying the graph in a post-processing step. If neato is just a convenient default, then you should be able to solve your problem by using dot as your layout engine instead, and using "rankdir=UD", plus a couple of additional kludges if X needs to be due south.</p> <p>In the event that you only need the constraint to apply for a single node X, then putting X and A together in a cluster should do the job:</p> <pre><code>graph sample { rankdir=UD layout=dot overlap=false // .. as before A -- X subgraph clusterone { style=invisible A X } } </code></pre> <p>If you need a strictly-south constraint to apply to arbitrary children of A, then that kind of clustering followed by the trick described in:</p> <p><a href="https://stackoverflow.com/questions/1476241/how-to-force-all-nodes-in-the-same-column-in-graphviz">How to force all nodes in the same column in graphviz?</a></p> <p>might do the trick. The attribute <code>clusterrank=local</code> might also be useful in that case, but I'm not certain. Hope this helps.</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