8

With the following dot code

digraph DG {
    G -> V;
    G -> E;
    G -> P;
    G -> C;
}

I generate the following graph

dot-generated graph

How could I move the node G in the centre? That is I wish to get something like this: wished result

p.s. My experiments with setting the rank of the edge didn't work out.

Community
  • 1
  • 1
Max Li
  • 5,069
  • 3
  • 23
  • 35

1 Answers1

8

For the general case, the easiest thing to do is to use twopi or neato instead of dot as your layout engine.

Twopi:

twopi layout

Neato:

neato

If you're truly confined to dot, this will give you close to what you want, though you'll have to customize each graph.

digraph g 
{
    P -> G [dir=back];
    subgraph clusterGVE {
        {rank=same V; G; E;}
        G -> V [constraint=false];
        G -> E;
        color=invis;
    };
    G -> C;
}

Dot

Dan
  • 2,157
  • 20
  • 24