List and order
Peter Otten
__peter__ at web.de
Mon May 15 12:36:00 EDT 2006
Nic wrote:
> The only problem is that from:
> 12
> 22
> 21
> In spite of writing
> 12 12 22
> it writes
> 12 21 22
> Do you know how is it possible to delete also this last trouble?
I thought that the two 12 were a typo, but it seems you want to reorder the
nodes inside an edge, too. Here's a fix that normalizes the edge before
sorting the list of edges:
edges = [sorted((ddeg[u], ddeg[v])) for u, v in G.edges()]
edges.sort()
for a, b in edges:
print a, b,
print
Peter
More information about the Python-list
mailing list