Created
September 2, 2009 12:16
-
-
Save anomit/179680 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" | |
Sorting nodes of a graph according to their degrees | |
Idea from: http://mail.python.org/pipermail/python-list/2002-July/152876.html | |
""" | |
#example adjacency list | |
adjlist = {'a':['b','c','d'],'b':['a','d'],'c':['a'],'d':['b','a']} | |
histogram = [ (len(value), key) for key, value in adjlist.iteritems() ] | |
histogram.sort() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment