@@ -0,0 +1,774 @@
+from toolz.curried import *%0Aa, b, c, d, e, f, g = 'abcdefg'%0A%0Aedges = %5B(a, b), (b, a), (a, c), (a, d), (d, a), (d, e), (e, f), (d, f),%0A         (f, d), (d, g), (e, g)%5D%0A%0A%0Aout_degrees = countby(first,  edges)%0A# %7B'a': 3, 'b': 1, 'd': 4, 'e': 2, 'f': 1%7D%0A%0Ain_degrees  = countby(second, edges)%0A# %7B'a': 2, 'b': 1, 'c': 1, 'd': 2, 'e': 1, 'f': 2, 'g': 2%7D%0A%0A%0Aout_neighbors = valmap(comp(tuple, map(second)),%0A                       groupby(first, edges))%0A# %7B'a': ('b', 'c', 'd'),%0A#  'b': ('a',),%0A#  'd': ('a', 'e', 'f', 'g'),%0A#  'e': ('f', 'g'),%0A#  'f': ('d',)%7D%0A%0Ain_neighbors  = valmap(comp(tuple, map(first)),%0A                       groupby(second, edges))%0A# %7B'a': ('b', 'd'),%0A#  'b': ('a',),%0A#  'c': ('a',),%0A#  'd': ('a', 'f'),%0A#  'e': ('d',),%0A#  'f': ('e', 'd'),%0A#  'g': ('d', 'e')%7D%0A

add graph example