Reputation: 649
I have the codes here,
import graphviz as gv
d=gv.Digraph()
d.edge('a','b')
d.edge('a','c')
d.edge('b','c')
the output is as pic:
How can I get a graph like this:
Upvotes: 0
Views: 55
Reputation: 7659
Not using Python, I only have a pure graphviz
answer but you should be able to translate that easily into Python.
You need to do two things:
rank = same
instruction (not strictly necessary in the example context but may be needed for more complex graphs)Here we go:
digraph so
{
n_1[ label = "a" ];
n_2[ label = "b" ];
n_3[ label = "c" ];
n_4[ label = "c" ];
{ rank = same; n_2 n_3 }
n_1 -> { n_2 n_3 };
n_2 -> n_4;
}
which gives you
Upvotes: 1