The distance between the edges and nodes in the graph

How to adjust the distance between edges and nodes (red), i.e. external shape node (blue)?

Diagram of distance between edges and nodes

+4
source share
3 answers

Here is a technique you can consider avoiding the need to create a custom node form. There may be some taste questions that you may need for a further search in order to get exactly what you want.

The advantage of this method, using HTML-like labels , is that changing the space inside and outside the rectangle becomes a simple matter by changing the internal number of points (here 4) and the external number of points (here 16) respectively.

digraph { node [shape=none] O [label=< <TABLE BORDER="0" CELLBORDER="1" CELLSPACING="16" CELLPADDING="4"> <TR><TD WIDTH="70">\N</TD></TR> </TABLE> >] {a,b,c,d} -> O } 

Result:

GIF rendered by 'dot' for the above graphviz input

You can change the BORDER and CELLBORDER parameters to show or hide the rectangles. You can adjust their thickness, but only in multiples of 1 point. I used the WIDTH parameter to force the width to height ratio, which causes the alignment of all arrow tips. Otherwise, some of the tips will correspond to the sides of the invisible outer rectangle.

+3
source

As in the other answer, this is not a very easy feat. Using a combination of height, width, fixed size, labelloc, and margin node options, you can get the effect you want that you want. Margin is best if you want to expand this distance, but to minimize it you need to use other parameters. For example, this graph will have arrows, almost touching the text 'O' node.

 digraph { node [shape="none" width=.2 height=.2 fixedsize="true" labelloc="top"]; a -> O; b -> O; c -> O; d -> O; } 

Alternatively, if you really want to make an effort, you can create a custom node form and do whatever you want with it.

+2
source

This is impossible AFAIK.

The only option available is to use headclip so that the edge moves to the center of the node or to the edge of the outer shape (as in your example).

You can try to add some addition to the node by putting it in a cluster and getting a clip of edges on the (invisible) border of the cluster:

 digraph { compound=true; subgraph cluster1 { style=invis; 2; } 1 -> 2[lhead=cluster1]; } 

Hope someone knows it's better to hack this ...

+1
source

All Articles