p0lAris
p0lAris

Reputation: 4820

Newbie graphviz edge direction issue

I have an undirected graph with the following schema:

graph G {
    A -- B;
    B -- C;
    C -- D;
    D -- A;
}

The graph is top to bottom as you see yourself. But I wanted to be in the form of a rectangle where A is top-left and D is bottom-right and I don't really have a clue how to do it.

Upvotes: 0

Views: 197

Answers (2)

p0lAris
p0lAris

Reputation: 4820

I have got another solution without neato I guess that renders with dot properly.

graph G{
    {rank=same A B}
    {rank=same C D}

    A -- B;
    B -- C;
    D -- A;
    D -- C;
}

Upvotes: 0

artur grzesiak
artur grzesiak

Reputation: 20348

graph G {
A [ 
label = A
pos = "0,0!" 
]
B [ 
label = B
pos = "5,0!"
]
C [ 
label = C
pos = "5,5!"
]
D [ 
label = D
pos = "0,5!"
]
A -- B;
B -- C;
C -- D;
D -- A;
}

and use neato to generate the image file. (it did not work with dot for me)

Upvotes: 1

Related Questions