List and order
Nic
nospam at nospam.nospam
Mon May 15 04:59:30 EDT 2006
Hello,
I'm using the NetworkX Python package (https://networkx.lanl.gov/).
Through this package I wrote the following code:
import networkx as NX
G=NX.Graph()
G.add_edge(1,2)
G.add_edge(2,3)
G.add_edge(3,4)
ddeg=G.degree(with_labels=True)
for (u,v) in G.edges():
print ddeg[u],ddeg[v]
As result, I have:
12
22
21
I'd like to order the numbers included in the couples in a decrescent way:
12
12
22
And then to write the couples on a single line, always in a decrescent way:
12 12 22
I'm not able to do this operation. Can you help me please?
Thanks a bunch,
Nic
More information about the Python-list
mailing list