Skip to content

Instantly share code, notes, and snippets.

@jberkel
Created November 14, 2010 01:34
Show Gist options
  • Select an option

  • Save jberkel/675818 to your computer and use it in GitHub Desktop.

Select an option

Save jberkel/675818 to your computer and use it in GitHub Desktop.
#"sorting" python dicts
sorted(nx.degree(G).items(), lambda x,y: cmp(x[1], y[1]), reverse=True )[0:30]
sorted(nx.degree(G).items(), key=lambda(k,v): (v,k), reverse=True)[0:30]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment