Point an edge to a cluster

Is there a way to point an arrow to a cluster instead of to a node?

If you can't, can you think of some reliable and consistently replicable work around that makes it look like this? As in somehow perfectly aligning the cluster with a large invisible node that sits on another layer?

This is a simplification of the case I'm working on:

[graphviz, dot-example, png]
----
digraph G {

rankdir=LR; /* graph from left to right */
fontname=ubuntu; /* ubuntu is our standard font */
labeljust=l; /* cluster labels aligned left */
splines=ortho; /* arrows are straight and w 90 deg angles */
penwidth=2; /* for cluster borders */
color=gray; /* for cluster borders */

/* default node config: */
node [shape=box fontsize=14 width=1.5 height=1 fixedsize=true ]

subgraph cluster0
{

{
rank = same; /* rank=same aligns both elements */
a;
aout
}
subgraph cluster3{
margin=8
style=dashed
color=grey
choice [height=2.2 width=1]
b
c
}
d
aout -> a
a -> choice
choice -> {b c}
{b c} -> d
d -> aout [tailport=s headport=e color=blue constraint=false] /* arrow leaves south of block, reaches east of another block, same as saying: d:s -> aout:e */

}
}
----

Attached is what this code produces.
What I want is to change:
a -> choice to a -> cluster3 ...and
{b c} -> d to cluster3 -> d

is there any way of making this possible?

Bonus question, is there a way to keep a minimum margin around each edge? Notice how the blue arrow is so close to the cluster's margin? Is there a way to keep some more space between them? Maybe adding a margin to the cluster?

Thanks!
Nico

Just for completeness, while

Just for completeness, while "dot" does not allow for edges between clusters, "fdp" does:

See http://graphviz.org/content/fdpclust or play with it here.

Hermann.
 

Set compound=true and

Set

  compound=true

and then use

  a -> choice [lhead=cluster3]
  {b c} -> d [ltail=cluster3]

The lhead and ltail attributes specify the logical head and tail of the edge.

I have to punt on the bonus question. The current implementation of orthogonal edge routing does even take clusters into account.

there is no attribute to set margin of spline inside cluster

As you know htere are attributes for certain margins and separating edges from nodes, but as far as I know Emden is right that we don't have any code to move edges away from the sides of clusters.

This would be a medium level project if someone woudld like to work on it. I think all the work would be in lib/dotgen/dotsplines.c  to set the spline route polygon to use a margin.  You also need to ensure the cluster has enough space to draw the splines including the requested margin. Maybe it is not that complicated though there is code like #define FUDGE that indicates there are already workarounds for certain problems.

Stephen North

Recent comments