From: Alan G I. <ai...@am...> - 2006-05-26 15:00:27
|
On Fri, 26 May 2006, Giandomenico Sica apparently wrote: > Insert a number: 4 > Couples: [[4, 3], [4, 2], [4, 1], [3, 2], [3, 1], [2, 1]] > What I'd like to do is drawing with Matplotlib a graph having as nodes > 1, 2, 3, 4 and as edges among the nodes the above couples. n = input("Insert a number" ) a = reversed(range(1,n+1)) coppie = [[i,j] for i in a for j in range(1,i)] print coppie G = NX.Graph() for edge in coppie: G.add_edge(*edge) print G.edges() NX.draw(G) pylab.savefig(r'c:\temp\temp.eps') hth, Alan Isaac |