How to put a node in the center of the dot-generated graph
Asked Answered
V

1

9

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.

Vendetta answered 7/2, 2015 at 15:59 Comment(0)
T
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

Trapp answered 10/2, 2015 at 4:16 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.