Hello,
I'm new in Matplotlib and am writing in order to ask a help.
I've developed a little software with Python that, by inserting a
number, calculate a list of couples.
Example
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. (sample
drawing: https://networkx.lanl.gov/)
Can you help me to make this operation please?
My code at the present is the following one.
n = input("Insert a number" )
a = range(n)
p = 0
q = 1
coppie = []
coppia = []
while len(a) - p != 1:
coppia.append(len(a) - p)
coppia.append(len(a) - p - q)
coppie.append(coppia)
coppia = []
if len(a) - p - q != 0:
q = q + 1
if len(a) - p - q == 0:
p = p + 1
q = 1
print coppie
I suppose it is quite easy but in spite of this have some difficulty.
Really many thanks for the help!
Best,
Nico