Reputation: 21
I can not control an edge's head and tail position between 2 nodes.
I'm setting up a node like a graph below
digraph G{
node [shape = "box"]
a -> b
b -> a
}
Upvotes: 2
Views: 2834
Reputation: 7659
This first part is basically the same answer that @marapet has given already:
digraph G
{
node[ shape = "box" ];
a:w -> b:w;
a:e -> b:e[ dir = back ];
}
It produces a graph with round edges:
If that's OK, then marapet's answer should be accepted.
If you insist on the shape that you provided in your post, a bit more complicated procedure needs to be applied:
digraph G
{
// we create the two nodes to be displayed
node[ shape = "box" ];
a b;
//we also create four empty nodes for routing the edges
node[ shape = point, height = 0 ];
x1 x2 x3 x4;
// we make sure that the nodes are arranged on the right levels
{ rank = same; x1 a x2 }
{ rank = same; x3 b x4 }
// we draw the edges one by one as the heads are varying
x1 -> a[ dir = none ];
a -> x2[ dir = back ];
x1 -> x3[ dir = none ];
x2 -> x4[ dir = none ];
b -> x4[ dir = none ];
x3 -> b;
}
This gives you
Upvotes: 3
Reputation: 56516
The head and tail position of an edge can be defined by using compass points as specified in The dot language, or by using the headport
or tailport
attributes:
digraph G{
node [shape = "box"]
a:w -> b:w
b -> a [headport=e, tailport=e]
}
Upvotes: 1