I'm drawing graphs in python using graphviz. The pictures I get are almost as I want them, with one exception: the position of (some of) the nodes are not as I'd like them to be. Here is my example:
import graphviz as gv
A=[[1],[2,3,5,7],[4,6,9,10],[8]]
G=gv.Digraph(format='png',filename='Test')
for k in range(len(A)-1):
for l in A[k]:
G.node(str(l))
for m in A[k+1]:
if m%l==0:
G.edge(str(l),str(m))
G.view()
And that's the result:
My problem here is that I want the nodes of the same rank to be ordered by magnitude, so that "2" is the leftmost node of rank 1 (starting from rank 0), "4" is the leftmost node of rank 2, etc.
Thanks for answers!
Martin