If you can control the order of the nodes in the edgesas you add them,
then the dot file order reflects the bipartite structure. In that
case the drawings come out how you want. The following produces two
rows of nodes with edges between:
In [1]: import pygraphviz as pgv
In [2]: G=pgv.AGraph()
In [3]: G.add_edge('a',1)
In [4]: G.add_edge('a',2)
In [5]: G.add_edge('b',2)
In [6]: G.add_edge('c',2)
In [7]: G.add_edge('c',3)
In [8]: G
Out[8]:
strict graph {
a -- 1;
a -- 2;
b -- 2;
c -- 2;
c -- 3;
}
In [9]: G.layout(prog='dot')
In [10]: G.draw('test.png')
Aric
Yes, you can set all of the dot file attributes
http://www.graphviz.org/content/attrs
You can probably change some of the graph attributes to adjust the size, etc.
Use the "graph_attr" data dictionary like this:
In [1]: import pygraphviz as pgv
In [2]: G=pgv.AGraph()
In [3]: G.graph_attr['rankdir']='LR'
In [4]: G.graph_attr['splines']='true'
In [5]: G
Out[5]:
strict graph {
graph [rankdir=LR,
splines=true
];
}
Aric